Bug 39717 - [4.5 Regression][cond-optab] CSE does not put subregs into COMPAREs on many CC0 machines
Summary: [4.5 Regression][cond-optab] CSE does not put subregs into COMPAREs on many C...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.0
: P4 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 39714
  Show dependency treegraph
 
Reported: 2009-04-10 12:46 UTC by Paolo Bonzini
Modified: 2024-06-08 10:56 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Bonzini 2009-04-10 12:46:04 UTC
/* cris and mn10300 -O2 */
foo (float *c)
{
  union
  {
    float r;
    unsigned int i;
  }
  e;
  e.r = c[0];
  if (e.i < 0x3f7f0000) return (e.r = e.r / 2.0f, e.i);
  return ((int) e.i < 0) ? 0 : 255;
}



Probably this is a duplicate too for vax:

int a, b;
int baz (short x) {  return x; }
int bar (int x) {
  if (baz (a ^ x ^ a)) return b;
  return 0;
}
int foo (void) {
  return bar (a == 0 || 1 == 1 - a) ? 1 : bar (1 && a);
}
Comment 1 Hans-Peter Nilsson 2009-04-16 03:08:19 UTC
Is this a cond-optab regression or "just" an observation?
Comment 2 Paolo Bonzini 2009-04-16 08:04:45 UTC
Subject: Re:  [cond-optab] CSE does not put subregs into
 COMPAREs on many CC0 machines

> Is this a cond-optab regression or "just" an observation?

Yes, it causes extra moves on code using unions.  Where we have

   r20:SI=r19:SF#0    where X#0 = (subreg X 0)
   cc0=r20:SI

is now

   r20:SI=r19:SF#0
   cc0=cmp(r20:SI,0)

and CSE is somehow not able to turn it into

   cc0=cmp(r19:SF#0,0)

Comment 3 Paolo Bonzini 2009-07-14 22:38:36 UTC
Fixed by the new SRA thanks to its usage of VIEW_CONVERT_EXPR at the tree level.