public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/29144] New: Missing if-conversion. If-conversion dependent on operand order. Inconsistent if-conversion.
@ 2006-09-19 15:51 Hakon dot Bugge at scali dot com
2009-02-06 20:58 ` [Bug rtl-optimization/29144] " steven at gcc dot gnu dot org
0 siblings, 1 reply; 3+ messages in thread
From: Hakon dot Bugge at scali dot com @ 2006-09-19 15:51 UTC (permalink / raw)
To: gcc-bugs
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 none. IMHO, four cmov's should have been produced. I further expect
all four functions to 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.
Here is the source code:
---------------------------------------------------------------------
/* if construct, near obvious cse */
int a(int c, int a, int b, int o) {
int r;
if (c) {
r = a - b;
} else {
r = a + o - b;
}
return r;
}
/* if construct, absolute obvious cse */
int b(int c, int a, int b, int o) {
int r;
if (c) {
r = a - b;
} else {
r = a - b + o;
}
return r;
}
/* conditional assignment, near obvious cse */
int c(int c, int a, int b, int o) {
int r;
r = (c) ? a - b : a + o - b;
return r;
}
/* conditional assignment, absolute obvious cse */
int d(int c, int a, int b, int o) {
int r;
r = (c) ? a - b : a - b + o;
return r;
}
---------------------------------------------------------------------
--
Summary: Missing if-conversion. If-conversion dependent on
operand order. Inconsistent if-conversion.
Product: gcc
Version: 3.4.5
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Hakon dot Bugge at scali dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29144
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/29144] Missing if-conversion. If-conversion dependent on operand order. Inconsistent if-conversion.
2006-09-19 15:51 [Bug c/29144] New: " Hakon dot Bugge at scali dot com
@ 2009-02-06 20:58 ` steven at gcc dot gnu dot org
0 siblings, 0 replies; 3+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-02-06 20:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from steven at gcc dot gnu dot org 2009-02-06 20:58 -------
The "near obvious cse" cases are not obvious (requires reassociation). To make
them redundant, you need code hoisting.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |23286
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-02-06 20:58:37
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29144
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-02 6:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-29144-4@http.gcc.gnu.org/bugzilla/>
2021-08-18 21:35 ` [Bug rtl-optimization/29144] Missing if-conversion. If-conversion dependent on operand order. Inconsistent if-conversion pinskia at gcc dot gnu.org
2023-06-02 6:04 ` pinskia at gcc dot gnu.org
2006-09-19 15:51 [Bug c/29144] New: " Hakon dot Bugge at scali dot com
2009-02-06 20:58 ` [Bug rtl-optimization/29144] " steven at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).