This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/15457] New: [tree-ssa] Convert a sign bit testing into "a < 0"


Convert a sign bit testing into "a < 0".

void bar (void);

void
foo (signed int a)
{
  signed int b = a & (signed int) 0x80000000;
  if (b)
    bar ();
}

void
baz (signed int a)
{
  signed int b = a & 0x80000000;
  if (b)
    bar ();
}

void
baa (signed int a)
{
  signed int b = a & (1 << 31);
  if (b)
    bar ();
}

The last tree-ssa form looks like:

;; Function foo (foo)

foo (a)
{
  int b;

<bb 0>:
  b_2 = a_1 & -2147483648;
  if (b_2 != 0) goto <L0>; else goto <L1>;

<L0>:;
  bar () [tail call];

<L1>:;
  return;

}



;; Function baz (baz)

baz (a)
{
  int b;
  int T.0;

<bb 0>:
  T.0_1 = -080000000;
  b_3 = a_2 & T.0_1;
  if (b_3 != 0) goto <L0>; else goto <L1>;

<L0>:;
  bar () [tail call];

<L1>:;
  return;

}



;; Function baa (baa)

baa (a)
{
  int b;

<bb 0>:
  b_2 = a_1 & -2147483648;
  if (b_2 != 0) goto <L0>; else goto <L1>;

<L0>:;
  bar () [tail call];

<L1>:;
  return;

}

-- 
           Summary: [tree-ssa] Convert a sign bit testing into "a < 0"
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]