HackerTrans
TopNewTrendsCommentsPastAskShowJobs

stassats

no profile record

comments

stassats
·5 bulan yang lalu·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
·5 bulan yang lalu·discuss
Still 40 years to go.
stassats
·5 bulan yang lalu·discuss
I have also seen some outright crashes on the new GC.
stassats
·7 bulan yang lalu·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
·7 bulan yang lalu·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
·8 bulan yang lalu·discuss
ABCL is really slow.
stassats
·9 bulan yang lalu·discuss
A good strategy if you don't care about fixing bugs.
stassats
·10 bulan yang lalu·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
·10 bulan yang lalu·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.