Closed
Description
https://c.godbolt.org/z/GEb9G3bMq
This C code, compiled with -O3
:
#include <inttypes.h>
#include <stdlib.h>
uint64_t foo(uint64_t x) {
if (x >> 47 == 0xffe5) { // equivalent to (x & 0xffff800000000000) == 0x7ff2800000000000
abort();
}
return 0x7ff2800000000003;
}
produces:
foo:
shr rdi, 47
cmp edi, 65509
je .LBB0_2
movabs rax, 9219572124669181952 ; 0x7ff2800000000000
add rax, 3
ret
.LBB0_2:
push rax
call abort@PLT
where the movabs
+ add
could trivially be just movabs rax, 9219572124669181955
, as the movabs
ends up being used only here.