I'm lost about the use of "sxth" in ARM64 assembly. For example, what's the purpose of "sxth #2" in the following instruction?
adds w21, w22, w23, sxth #2
Thanks!
The register w23
is sign-extended from 16 bits to 32 bits and then left-shifted by 2 places. In general, if an extension is followed by an immediate, that immediate is a left-shift amount applied after sign/zero extension.
See ARMv8-A Architecture Reference Manual, section C6.2.7 ADDS (extended register).