public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14347] New: ifconvert doesn't generate conditional store on i386
@ 2004-02-29 16:57 ak at muc dot de
  2004-02-29 17:17 ` [Bug optimization/14347] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ak at muc dot de @ 2004-02-29 16:57 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-05-31 12:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-29 16:57 [Bug optimization/14347] New: ifconvert doesn't generate conditional store on i386 ak at muc dot de
2004-02-29 17:17 ` [Bug optimization/14347] " pinskia at gcc dot gnu dot org
2004-05-31  1:57 ` [Bug rtl-optimization/14347] " pinskia at gcc dot gnu dot org
2004-05-31 17:55 ` ak at muc dot de
2004-05-31 18:13 ` pinskia at gcc dot gnu dot org
2004-05-31 18:34 ` ak at muc dot de
2004-05-31 18:48 ` pinskia at gcc dot gnu dot org
2004-05-31 22:19 ` ak at muc dot de

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).