Hacker News new | ask | show | jobs
by koito17 657 days ago
> I assume this was some toy compiler

I dont know the definition of "toy compiler", but compare the following (x86 backend vs arm64 backend)

https://github.com/Clozure/ccl/blob/d960a0e/compiler/X86/x86...

https://github.com/Clozure/ccl/blob/d960a0e/compiler/ARM64/a...

I would argue the former is a lot more complex compared to the functional equivalent in arm64

The specific extension to allow e.g. minss would look something like this

  (def-x86-opcode minss ((:regxmm :insert-xmm-rm) (:regxmm :insert-xmm-reg))
    #x0f5d #o300 #x0 #xf3)
Now try doing the same for e.g. movsxd, and you will have to be careful with the ModR/M byte, due to the VEX prefix changing semantics.