https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109463
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords| |missed-optimization
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang/LLVM produces:
movq %rdi, %xmm1
punpckldq .LCPI1_0(%rip), %xmm1 # xmm1 =
xmm1[0],mem[0],xmm1[1],mem[1]
subpd .LCPI1_1(%rip), %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0 # xmm0 =
xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
retq
LCPI1_0 being:
.LCPI1_1:
.quad 0x4330000000000000 # double 4503599627370496
.quad 0x4530000000000000 # double 1.9342813113834067E+25
note clang even produces that even if you say the top bit is not set via:
double f(unsigned long x) { if (x >>63) __builtin_unreachable(); return x; }