------- Comment #1 from rahul at icerasemi dot com  2009-05-07 11:11 -------
Suspect tree-ter optimisation pass. Compiling with -O1 -fno-tree-ter produces
the right result. Using -fdump-tree-optimized shows SSA-Gimple to change from

shiftTest (const ulonglong var)
{
  int D.1842;

<bb 2>:
  if (var >> 31 & 1 == 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 5>:
  D.1842 = -1;
  goto <bb 4>;

<bb 3>:
  D.1842 = 0;

<bb 4>:
  return D.1842;

}

to

shiftTest (const ulonglong var)
{
  ulonglong predicate;
  int D.1842;
  const ulonglong D.1839;

<bb 2>:
  D.1839 = var >> 31;
  predicate = D.1839 & 1;
  if (predicate == 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 5>:
  D.1842 = -1;
  goto <bb 4>;

<bb 3>:
  D.1842 = 0;

<bb 4>:
  return D.1842;

}

Does the complex expression "var >> 31 & 1 == 0" cause problems during RTL
expansion phase?
Are the precedences of the SHIFT and AND operations maintained by the
expression replacement phase?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40057

Reply via email to