public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15241] New: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
@ 2004-05-01 12:58 kazu at cs dot umass dot edu
  2004-05-24 20:52 ` [Bug tree-optimization/15241] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 4+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-01 12:58 UTC (permalink / raw)
  To: gcc-bugs

We should convert foo into bar (if profitable).

void baz ();

unsigned int
foo (unsigned int a, unsigned int b)
{
  if (a <= 7 && b <= 7)
    baz ();
}

unsigned int
bar (unsigned int a, unsigned int b)
{
  if ((a | b) <= 7)
    baz ();
}

The last SSA form looks like:

;; Function foo (foo)

foo (a, b)
{
  _Bool T.2;
  _Bool T.1;
  _Bool T.0;

<bb 0>:
  T.0_2 = a_1 <= 7;
  T.1_4 = b_3 <= 7;
  T.2_5 = T.0_2 && T.1_4;
  if (T.2_5) goto <L0>; else goto <L1>;

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

<L1>:;
  return;

}



;; Function bar (bar)

bar (a, b)
{
  unsigned int T.3;

<bb 0>:
  T.3_3 = a_1 | b_2;
  if (T.3_3 <= 7) goto <L0>; else goto <L1>;

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

<L1>:;
  return;

}

On i686-pc-linux-gnu, I get:

foo:
	cmpl	$7, 4(%esp)
	setbe	%dl
	cmpl	$7, 8(%esp)
	setbe	%al
	testb	%al, %dl
	jne	.L5
	rep ; ret
	.p2align 4,,7
.L5:
	jmp	baz
	.size	foo, .-foo
	.p2align 4,,15
.globl bar
	.type	bar, @function
bar:
	movl	8(%esp), %eax
	orl	4(%esp), %eax
	cmpl	$7, %eax
	jbe	.L9
	rep ; ret
	.p2align 4,,7
.L9:
	jmp	baz

-- 
           Summary: [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7.
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: normal
          Priority: P2
         Component: 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=15241


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-15241-4@http.gcc.gnu.org/bugzilla/>
2012-03-09  6:09 ` [Bug tree-optimization/15241] [tree-ssa] Convert a <= 7 && b <= 7 into (a | b) <= 7 pinskia at gcc dot gnu.org
2013-11-09 20:39 ` pinskia at gcc dot gnu.org
2014-10-31  4:02 ` pinskia at gcc dot gnu.org
2004-05-01 12:58 [Bug optimization/15241] New: " kazu at cs dot umass dot edu
2004-05-24 20:52 ` [Bug tree-optimization/15241] " pinskia at gcc dot gnu dot 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).