Re: [PATCH][GCC] Fix oversized shifts in PR/88903 testcase.

2019-01-22 Thread Richard Biener
On Mon, 21 Jan 2019, Tamar Christina wrote:

> Hi All,
> 
> The testcase for PR/tree-optimization 88903 hits
> undefined behavior for the overwide shifts.  This is
> causing the testcases to fail for all Arm platforms.
> 
> This updates the testcase to add an explicit & such
> that the behavior is consistent.
> 
> Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for trunk?

OK.

Richard.

> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
> 2019-01-21  Tamar Christina  
> 
>   PR/tree-optimization 88903
>   * gcc.dg/vect/pr88903-1.c: Add explicit &.
> 
> 

-- 
Richard Biener 
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)


[PATCH][GCC] Fix oversized shifts in PR/88903 testcase.

2019-01-21 Thread Tamar Christina
Hi All,

The testcase for PR/tree-optimization 88903 hits
undefined behavior for the overwide shifts.  This is
causing the testcases to fail for all Arm platforms.

This updates the testcase to add an explicit & such
that the behavior is consistent.

Regtested on aarch64-none-linux-gnu and no issues.

Ok for trunk?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

2019-01-21  Tamar Christina  

PR/tree-optimization 88903
* gcc.dg/vect/pr88903-1.c: Add explicit &.

-- 
diff --git a/gcc/testsuite/gcc.dg/vect/pr88903-1.c b/gcc/testsuite/gcc.dg/vect/pr88903-1.c
index dead2b5e723eaff77fa1edb6ae32d12b005c680e..77dbfd47c91be8cce0edde8b09b7b90d40268306 100644
--- a/gcc/testsuite/gcc.dg/vect/pr88903-1.c
+++ b/gcc/testsuite/gcc.dg/vect/pr88903-1.c
@@ -7,8 +7,8 @@ foo()
 {
   for (int i = 0; i < 512; ++i)
 {
-  x[2*i] = x[2*i] << (i+1);
-  x[2*i+1] = x[2*i+1] << (i+1);
+  x[2*i] = x[2*i] << ((i+1) & 31);
+  x[2*i+1] = x[2*i+1] << ((i+1) & 31);
 }
 }
 
@@ -20,7 +20,7 @@ main()
 x[i] = i;
   foo ();
   for (int i = 0; i < 1024; ++i)
-if (x[i] != i << (i/2+1))
+if (x[i] != i << ((i/2+1) & 31))
   __builtin_abort ();
   return 0;
 }