This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/51954] New: __int128_t negation can be optimized
- From: "svfuerst at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 22 Jan 2012 23:55:42 +0000
- Subject: [Bug rtl-optimization/51954] New: __int128_t negation can be optimized
- Auto-submitted: auto-generated
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