public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15457] New: [tree-ssa] Convert a sign bit testing into "a < 0"
@ 2004-05-15 23:39 kazu at cs dot umass dot edu
  2004-05-15 23:41 ` [Bug tree-optimization/15457] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-15 23:39 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <20040515120221.15457.kazu@gcc.gnu.org>]
[parent not found: <bug-15457-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-10-31  4:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-15 23:39 [Bug tree-optimization/15457] New: [tree-ssa] Convert a sign bit testing into "a < 0" kazu at cs dot umass dot edu
2004-05-15 23:41 ` [Bug tree-optimization/15457] " pinskia at gcc dot gnu dot org
2004-05-16  2:43 ` pinskia at gcc dot gnu dot org
2004-05-17 18:32 ` pinskia at gcc dot gnu dot org
2005-05-08 19:12 ` pinskia at gcc dot gnu dot org
2005-05-24 22:07 ` pinskia at gcc dot gnu dot org
     [not found] <20040515120221.15457.kazu@gcc.gnu.org>
2005-07-12 21:27 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15457-4@http.gcc.gnu.org/bugzilla/>
2012-01-05 23:12 ` pinskia at gcc dot gnu.org
2014-10-31  4:02 ` pinskia at gcc dot gnu.org

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