This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/51837] New: Use of result from 64*64->128 bit multiply via __uint128_t not 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: Thu, 12 Jan 2012 19:23:24 +0000
- Subject: [Bug middle-end/51837] New: Use of result from 64*64->128 bit multiply via __uint128_t not optimized
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51837
Bug #: 51837
Summary: Use of result from 64*64->128 bit multiply via
__uint128_t not optimized
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: svfuerst@gmail.com
unsigned long long foo(unsigned long long x, unsigned long long y)
{
__uint128_t z = (__uint128_t)x * y;
return z ^ (z >> 64);
}
Compiles into
mov %rsi, %rax
mul %rdi
mov %rax, %r9
mov %rdx, %rax
xor %r9, %rax
retq
The final two mov instructions are not needed, and the above is equivalent to
mov %rsi, %rax
mul %rdi
xor %rdx, %rax
retq