Bug 206646 - if-conversion and cse
if-conversion and cse
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc (Show other bugs)
4.3
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-15 10:11 EDT by Hakon Bugge
Modified: 2007-11-16 20:14 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-09-18 14:43:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Hakon Bugge 2006-09-15 10:11:27 EDT
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 10:11:27 EDT
Created attachment 136360 [details]
C source program
Comment 2 Jakub Jelinek 2006-09-18 14:43:37 EDT
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 11:44:51 EDT
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.