[committed] testsuite: Add further testcase for already fixed PR [PR109778]

Message ID ZFoesHMLC1fRG9qd@tucnak
State Accepted
Headers
Series [committed] testsuite: Add further testcase for already fixed PR [PR109778] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jakub Jelinek May 9, 2023, 10:21 a.m. UTC
  Hi!

On Tue, May 09, 2023 at 08:55:56AM +0000, Richard Biener wrote:
> OK.

Thanks.

I came up with a testcase which reproduces all the way to r10-7469.
LTO to avoid early inlining it, so that ccp handles rotates and not
shifts before they are turned into rotates.

Tested on x86_64-linux -m32/-m64, both trunk and 10 branch, committed
to trunk as obvious so far:

2023-05-09  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/109778
	* gcc.dg/lto/pr109778_0.c: New test.
	* gcc.dg/lto/pr109778_1.c: New file.



	Jakub
  

Patch

--- gcc/testsuite/gcc.dg/lto/pr109778_0.c.jj	2023-05-09 12:03:18.186428978 +0200
+++ gcc/testsuite/gcc.dg/lto/pr109778_0.c	2023-05-09 12:00:18.506004676 +0200
@@ -0,0 +1,22 @@ 
+/* PR tree-optimization/109778 */
+/* { dg-lto-do run } */
+/* { dg-lto-options { "-O2 -flto" } } */
+/* { dg-require-effective-target int32 } */
+
+int bar (int);
+
+__attribute__((noipa)) int
+foo (int x)
+{
+  x = bar (x);
+  x = (x << 16) | (int) ((unsigned) x >> 16);
+  return x & 0x10000000;
+}
+
+int
+main ()
+{
+  if (foo (0) || foo (-1))
+    __builtin_abort ();
+  return 0;
+}
--- gcc/testsuite/gcc.dg/lto/pr109778_1.c.jj	2023-05-09 12:03:21.504381415 +0200
+++ gcc/testsuite/gcc.dg/lto/pr109778_1.c	2023-05-09 12:00:07.062168719 +0200
@@ -0,0 +1,7 @@ 
+int
+bar (int x)
+{
+  x &= 0x22222222;
+  x |= (int) 0xf1234567U;
+  return x;
+}