HackerTrans
TopNewTrendsCommentsPastAskShowJobs

stassats

no profile record

comments

stassats
·hace 5 meses·discuss
I did that to write simd routines for sbcl: https://github.com/sbcl/sbcl/blob/master/src/code/arm64-simd... Probably the best way of writing assembly, can evaluate the function immediately, use macros and any other code to emit instructions, even can print register values (instruction-level stepping would be even better, but too much work).
stassats
·hace 5 meses·discuss
Still 40 years to go.
stassats
·hace 5 meses·discuss
I have also seen some outright crashes on the new GC.
stassats
·hace 7 meses·discuss
The tricks to avoid multiplication (and division) are probably worth a whole post.

  x * 6:
  lea eax, [rdi+rdi*2]
  add eax, eax

  x * 7:
  lea eax, [0+rdi*8]
  sub eax, edi
  
  x * 11:
  lea eax, [rdi+rdi*4]
  lea eax, [rdi+rax*2]
But with -Os you get imul eax, edi, 6

And on modern CPUs multiplication might not be actually all that slow (but there may be fewer multiply units).
stassats
·hace 7 meses·discuss
The text mentions that it can also do multiplication but doesn't expand on that.

E.g. for x * 5 gcc issues lea eax, [rdi+rdi*4].
stassats
·hace 8 meses·discuss
ABCL is really slow.
stassats
·hace 9 meses·discuss
A good strategy if you don't care about fixing bugs.
stassats
·hace 10 meses·discuss
That shouldn't mean that it doesn't return a NaN. Things are generally not optimized away because of NaNs. E.g. in GCC, abs(c) > -1.0 is not folded, unless building with -ffast-math
stassats
·hace 10 meses·discuss
That fix has limited applicability. x * x is also a non-negative float. But abs(x * x) is not optimized. Or abs(abs(x)+1). GCC, for example, does know that.