HackerTrans
トップ新着トレンドコメント過去質問紹介求人

stassats

no profile record

コメント

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