diff mbox

Fix up pr19105.c test regexp for ppc (PR testsuite/55188)

Message ID 20121105104449.GH1881@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 5, 2012, 10:44 a.m. UTC
Hi!

Depending on branch cost, e.g. on ppc v != d && v != e
isn't folded in the FE.  On x86_64/i686 we have in *.original
for range1:
return (x != 0 && (unsigned int) v != 2) && (unsigned int) v + 4294967293 > 1;
but on ppc
return ((x != 0 && (unsigned int) v != 2) && (unsigned int) v != 3) && (unsigned int) v != 4;
The inter-bb range test optimization optimizes both the same, into
x != 0 && (unsigned int) v + 4294967294 > 2
equivalent (gimplified of course), but it prints different message that
the test was trying to match to see if the optimization happened.

The following patch adjusts the regexp.  Unfortunately I couldn't find a way
to insert there ERE () to make the regexp shorter
(wanted to have there .. and -.3, (3. and -.4, )?4. or
and -.3, (3. and -.4, |)4.
but neither worked, not with zero, one, two or three backslashes before (
and ).  So I've ended up duplicating the whole regexp with just | in between
which seems to work.  Tested on x86_64-linux (-m32/-m64) and powerpc64-linux
cross (-m32/-m64), ok for trunk?

2012-11-05  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/55188
	* gcc.dg/pr19105.c: Accept also optimizing
	-[2, 2] and -[3, 3] and -[4, 4] range tests together.


	Jakub
diff mbox

Patch

--- gcc/testsuite/gcc.dg/pr19105.c.jj	2012-10-31 09:44:44.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr19105.c	2012-11-05 11:29:33.921707151 +0100
@@ -17,6 +17,6 @@  int range2 (enum e v, int x)
   return x && (v != c && v != d && v != e);
 }
 
-/* { dg-final { scan-tree-dump-times "Optimizing range tests v_\[0-9\]*.D. -.2, 2. and -.3, 4.\[\n\r\]* into" 1 "reassoc1" } } */
+/* { dg-final { scan-tree-dump-times "Optimizing range tests v_\[0-9\]*.D. -.2, 2. and -.3, 4.\[\n\r\]* into|Optimizing range tests v_\[0-9\]*.D. -.2, 2. and -.3, 3. and -.4, 4.\[\n\r\]* into" 1 "reassoc1" } } */
 /* { dg-final { cleanup-tree-dump "reassoc1" } } */