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:
Created attachment 136360 [details] C source program
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.
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