----- Original Message -----
From: "Kai Tietz" <kti...@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: "Richard Guenther" <richard.guent...@gmail.com>
Sent: Tuesday, October 18, 2011 1:33:17 PM
Subject: [patch testsuite]: Adjust tree-ssa/builtin-expect-*.c tests for high 
cost-branching optimization

Hello,

this patch adjusts __builtin_expect tests in tree-ssa so, that short-circuit 
branch optimization don't lead to fallout.  I've used here a multiplication, as 
simple substraction/addition might get optimized away.

ChangeLog

2011-10-18  Kai Tietz  <kti...@redhat.com>

        * gcc.dg/tree-ssa/builtin-expect-1.c: Adjust test.
        * gcc.dg/tree-ssa/builtin-expect-2.c: Adjust test.
        * gcc.dg/tree-ssa/builtin-expect-3.c: Adjust test.
        * gcc.dg/tree-ssa/builtin-expect-4.c: Adjust test.
        * gcc.dg/tree-ssa/builtin-expect-5.c: Adjust test.


Regression tested for x86_64-unknown-linux-gnu. Ok for apply?

Regards,
Kai

--- gcc-head.orig/gcc/testsuite/gcc.dg/tree-ssa/builtin-expect-5.c
+++ gcc-head/gcc/testsuite/gcc.dg/tree-ssa/builtin-expect-5.c
@@ -1,9 +1,9 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-forwprop" } */
 
-f (int i, float j) 
+f (int i, float j, int i2, float j2) 
 { 
-  if (__builtin_expect (i > 0 && __builtin_expect (j != 0, 1), 0))
+  if (__builtin_expect ((i * i2) > 0 && __builtin_expect ((j * j2) != 0, 1), 
0))
     a ();
   else
     b ();

Well, this change might be not necessary. But to keep in all 5 tests the same 
conditions checked, I modified this too.  On the other hand, this change isn't 
really necessary, if we assume that this check is testing that __builtin_expect 
conditions aren't merged on short-circuit optimization.

Regards,
Kai

Reply via email to