This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/13355] Suboptimal code generated with global register variables
- From: "steven at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Nov 2012 22:46:53 +0000
- Subject: [Bug rtl-optimization/13355] Suboptimal code generated with global register variables
- Auto-submitted: auto-generated
- References: <bug-13355-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13355
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu.org
--- Comment #10 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-08 22:46:53 UTC ---
(In reply to comment #1)
> Created attachment 5301 [details]
> example .c file that shows behavior with
> gcc -march=i686 -mtune=i686 -fomit-frame-pointer -O2 test.c
GCC 4.7.1 compiles the two interesting functions in the test case to:
op_cmovl_EAX_T1_T0:
testl %ebx, %ebx
je .L2
movl %esi, 0(%ebp)
.L2:
ret
op_imull_EAX_T0:
subl $20, %esp
movl 0(%ebp), %eax
imull %ebx
movl %eax, (%esp)
movl %eax, 0(%ebp)
movl (%esp), %eax
movl %edx, 4(%esp)
movl %edx, 8(%ebp)
movl %eax, %edx
movl %eax, 8(%esp)
sarl $31, %edx
movl 4(%esp), %eax
movl %edx, 12(%esp)
cmpl %eax, 12(%esp)
setne %al
movzbl %al, %eax
movl %eax, 32(%ebp)
addl $20, %esp
ret
Trunk r193340 produces the following:
op_cmovl_EAX_T1_T0:
testl %ebx, %ebx
je .L2
movl %esi, 0(%ebp)
.L2:
ret
op_imull_EAX_T0:
subl $12, %esp
movl %ebx, %eax
imull 0(%ebp)
movl %eax, 0(%ebp)
movl %eax, (%esp)
sarl $31, %eax
movl %eax, 4(%esp)
xorl %eax, %eax
cmpl %edx, 4(%esp)
movl %edx, 8(%ebp)
setne %al
movl %eax, 32(%ebp)
addl $12, %esp
ret