Open Validark opened 4 months ago
Also, why can't we use shlx here?
Isn't shlx restricted to shift amount in a register?
Also, why can't we use shlx here?
Isn't shlx restricted to shift amount in a register?
Yes! You are right! That's why it wasn't giving me shlx
! I did not realize that. I updated my suggested assembly section.
@llvm/issue-subscribers-backend-x86
Author: Niles Salter (Validark)
I define the following 2 Zig functions: https://zig.godbolt.org/z/3xfc5bjEc
Emitting for Neoverse N2, I get:
Here is the LLVM IR:
Here is the LLVM IR produced by Clang for "equivalent" C code:
And the assembly:
On x86, compiling for Zen 4, I get: https://zig.godbolt.org/z/fYzqEWWvx
Looks like LLVM is making the decision that a multiply is less expensive than a
shl
?Also, why can't we useI would think we could do:shlx
here?