This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14347] New: ifconvert doesn't generate conditional store on i386
- From: "ak at muc dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Feb 2004 16:57:38 -0000
- Subject: [Bug optimization/14347] New: ifconvert doesn't generate conditional store on i386
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
x86 doesn't have a conditional store instruction. But it can be simulated.
e.g. in
int foo;
void f(int x)
{
if (x == 1)
foo = 2; /* generates a jump */
}
the jump can be avoided with
void f(int x)
{
int dummy;
int *fooptr = &dummy;
if (x == 1)
fooptr = &foo; /* will generate a CMOV and no jump */
*fooptr = 2;
}
I think this woule be an useful optimization to have. Right place is probably
ifcvt.c, but it just needs to be somehow taught to generate dummy stack
variables and then recognize this idiom. Also the target may need to set some
flag that it doesn't support conditional stores and they need to be simulated.
It's probably better to generate a new variable for each such optimization to
avoid possible store conflict stalls.
This may help on other architectures with a missing conditional store too.
--
Summary: ifconvert doesn't generate conditional store on i386
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ak at muc dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i386-*, x86_64-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14347