[Bug rtl-optimization/51954] New: __int128_t negation can be optimized
svfuerst at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 23 01:43:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51954
Bug #: 51954
Summary: __int128_t negation can be optimized
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: svfuerst@gmail.com
__int128_t neg(__int128_t x)
{
return -x;
}
Compiles into with -O3 :
mov %rdi, %rax
mov %rsi, %rdx
neg %rax
adc $0x0, %rdx
neg %rdx
retq
Note how the last three instructions before the return are dependent on each
other. This can be slightly improved with slightly more inter-instruction
parallelism:
mov %rdi, %rax
mov %rsi, %rdx
neg %rdx
neg %rax
sbb $0x0, %rdx
retq
More information about the Gcc-bugs
mailing list