This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/47521] New: Unnecessary usage of edx register
- From: "tony.poppleton at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 28 Jan 2011 17:19:06 +0000
- Subject: [Bug rtl-optimization/47521] New: Unnecessary usage of edx register
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47521
Summary: Unnecessary usage of edx register
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: tony.poppleton@gmail.com
In testing PR46235 I noticed some minor inefficiency in the usage of an extra
register.
The C code is:
int foo(int a, int x, int y)
{
if (a & (16))
return a;
return 1;
}
Which produces the asm:
movl %edi, %eax
movl $1, %edx
testb $16, %al
cmove %edx, %eax
ret
The above code could have been further optimized to remove the usage of edx:
movl $1, %eax
test $16, %edi
cmove %edi, %eax
ret