[Bug rtl-optimization/94806] New: Failure to optimize unary minus for 128-bit operand
gabravier at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Apr 27 18:12:40 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94806
Bug ID: 94806
Summary: Failure to optimize unary minus for 128-bit operand
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
__int128 f(__int128 x)
{
return -x;
}
It would appear like unary minus is badly optimized by GCC.
This is what LLVM outputs for this :
f(__int128): # @f(__int128)
mov rax, rdi
xor edx, edx
neg rax
sbb rdx, rsi
ret
And this is what GCC outputs :
f(__int128):
mov rax, rdi
mov rdx, rsi
neg rax
adc rdx, 0
neg rdx
ret
GCC's output is obviously worse (unless an `adc`+`neg` pair can somehow be
better than an `sbb`)
(See also https://godbolt.org/z/9AUd79)
More information about the Gcc-bugs
mailing list