Bug 206646 - if-conversion and cse
Summary: if-conversion and cse
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc
Version: 4.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-09-15 14:11 UTC by Hakon Bugge
Modified: 2007-11-17 01:14 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-09-18 18:43:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
C source program (611 bytes, application/octet-stream)
2006-09-15 14:11 UTC, Hakon Bugge
no flags Details

Description Hakon Bugge 2006-09-15 14:11:27 UTC
Description of problem:

Missing if-conversion. If-conversion dependent on operand order. Inconsistent 
if-conversion.

Four ways of coding a conditional assignment yields 1 conditional move using 
gcc 3.4.5 20051201 (Red Hat 3.4.5-2). gcc 4.0.2 20051130 (Red Hat 4.0.2-14.EL4) 
produces node. INHO four cmov's should have been produced. I do not see why all 
four functions generates the exact same code.

All recent new commercial compilers tested generates four cmov's:
 - intel 8.1, 9.0, and 9.1
 - pgi 5.2, 6.0, 6.1, and 6.2
 - pathscale 2.1, 2.2, 2.3, 2.4


Version-Release number of selected component (if applicable):


How reproducible:
allways


Steps to Reproduce:
gcc -O2 -S if_conversion.c;egrep cmov\|^[a-d]: if_conversion.s

  
Actual results:
a:
b:
c:
d:
        cmove   %ecx, %esi


Expected results:

One cmovX per function, four in total.

Additional info:

Comment 1 Hakon Bugge 2006-09-15 14:11:27 UTC
Created attachment 136360 [details]
C source program

Comment 2 Jakub Jelinek 2006-09-18 18:43:37 UTC
And is that actually faster?  AFAIK e.g. on Nocona cmov* is horribly slow.
Anyway, this is something that definitely won't be changed in GCC 3.4.x-RH.
GCC 4.1.x-RH and 4.2.0 (current GCC development) generate no cmov*s at all, but
if proven that it is actually faster, this would be something to consider for
GCC 4.3.0.  Can you please file it at http://gcc.gnu.org/bugzilla/?
Thanks.

Closing as WONTFIX, since this is definitely not RHEL4 material.

Comment 3 Hakon Bugge 2006-09-19 15:44:51 UTC
1) IMHO, the four routines should always produce the same code
2) Its hard to measure this, if gcc is unable to produce cmov*s ;-)  If if-
conversion is default off, but can be turned on, its no problem measuring its 
effect. But I believe that is nt the case.
3) I will file the issue at http://gcc.gnu.org/bugzilla

Thanks, Håkon


Note You need to log in before you can comment on or make changes to this bug.