On Sat, Jan 23, 2021 at 03:10:10PM -0600, Segher Boessenkool wrote:
> > The reason I chose the "no-strict-aliasing" attribute (and already
> > committed based on Richi's ack) was consistency with the i386
> > testcase.  I can change both.
> 
> Yes please.  Thanks!

So like this?
Tested on x86_64-linux (-m32/-m64) and powerpc64le-linux, ok for trunk?

        Jakub
2021-01-26  Jakub Jelinek  <ja...@redhat.com>

        * gcc.target/powerpc/m128-check.h (CHECK_EXP): Remove
        optimize ("no-strict-aliasing") attribute.
        * gcc.target/powerpc/sse-andnps-1.c (TEST): Copy e into float[4]
        array to avoid violating TBAA.
        * gcc.target/powerpc/sse2-andpd-1.c (TEST): Copy e.d into double[2]
        array to avoid violating TBAA.
        * gcc.target/powerpc/sse-andps-1.c (TEST): Copy e.f into float[4]
        array to avoid violating TBAA.
        * gcc.target/powerpc/sse2-andnpd-1.c (TEST): Copy e into double[2]
        array to avoid violating TBAA.

--- gcc/testsuite/gcc.target/powerpc/m128-check.h.jj    2021-01-23 
09:35:55.951060084 +0100
+++ gcc/testsuite/gcc.target/powerpc/m128-check.h       2021-01-26 
17:26:00.650087187 +0100
@@ -85,7 +85,6 @@ typedef union
 
 #define CHECK_EXP(UNION_TYPE, VALUE_TYPE, FMT)         \
 static int                                             \
-__attribute__((optimize ("no-strict-aliasing")))       \
 __attribute__((noinline, unused))                      \
 check_##UNION_TYPE (UNION_TYPE u, const VALUE_TYPE *v) \
 {                                                      \
--- gcc/testsuite/gcc.target/powerpc/sse-andnps-1.c.jj  2021-01-18 
07:18:14.958659311 +0100
+++ gcc/testsuite/gcc.target/powerpc/sse-andnps-1.c     2021-01-26 
17:26:34.446705618 +0100
@@ -30,6 +30,7 @@ TEST (void)
   int source1[4]={34, 545, 955, 67};
   int source2[4]={67, 4, 57, 897};
   int e[4];
+  float f[4];
    
   s1.x = _mm_loadu_ps ((float *)source1);
   s2.x = _mm_loadu_ps ((float *)source2);
@@ -39,7 +40,8 @@ TEST (void)
   e[1] = (~source1[1]) & source2[1];
   e[2] = (~source1[2]) & source2[2];
   e[3] = (~source1[3]) & source2[3];
+  __builtin_memcpy (f, e, sizeof (f));
 
-  if (check_union128 (u, (float *)e))
+  if (check_union128 (u, f))
     abort ();
 }
--- gcc/testsuite/gcc.target/powerpc/sse2-andpd-1.c.jj  2020-01-12 
11:54:38.062388530 +0100
+++ gcc/testsuite/gcc.target/powerpc/sse2-andpd-1.c     2021-01-26 
17:31:05.522645155 +0100
@@ -31,6 +31,7 @@ TEST (void)
     double d[2];
     long long ll[2];
   }source1, source2, e;
+  double d[2];
    
   s1.x = _mm_set_pd (34545, 95567);
   s2.x = _mm_set_pd (674, 57897);
@@ -42,7 +43,8 @@ TEST (void)
    
   e.ll[0] = source1.ll[0] & source2.ll[0];
   e.ll[1] = source1.ll[1] & source2.ll[1];
+  __builtin_memcpy (d, e.d, sizeof (d));
 
-  if (check_union128d (u, e.d))
+  if (check_union128d (u, d))
     abort ();
 }
--- gcc/testsuite/gcc.target/powerpc/sse-andps-1.c.jj   2020-01-12 
11:54:38.060388560 +0100
+++ gcc/testsuite/gcc.target/powerpc/sse-andps-1.c      2021-01-26 
17:27:06.754340867 +0100
@@ -32,6 +32,7 @@ TEST (void)
     float f[4];
     int   i[4];
   }source1, source2, e;
+  float f[4];
 
   s1.x = _mm_set_ps (34, 545, 955, 67);
   s2.x = _mm_set_ps (67, 4, 57, 897);
@@ -45,7 +46,8 @@ TEST (void)
   e.i[1] = source1.i[1] & source2.i[1];
   e.i[2] = source1.i[2] & source2.i[2];
   e.i[3] = source1.i[3] & source2.i[3];
+  __builtin_memcpy (f, e.f, sizeof (f));
 
-  if (check_union128 (u, e.f))
+  if (check_union128 (u, f))
     abort ();
 }
--- gcc/testsuite/gcc.target/powerpc/sse2-andnpd-1.c.jj 2021-01-18 
07:18:14.958659311 +0100
+++ gcc/testsuite/gcc.target/powerpc/sse2-andnpd-1.c    2021-01-26 
17:27:38.594981378 +0100
@@ -28,6 +28,7 @@ TEST (void)
   long long source1[2]={34545, 95567};
   long long source2[2]={674, 57897};
   long long e[2];
+  double d[2];
    
   s1.x = _mm_loadu_pd ((double *)source1);
   s2.x = _mm_loadu_pd ((double *)source2);
@@ -35,7 +36,8 @@ TEST (void)
    
   e[0] = (~source1[0]) & source2[0];
   e[1] = (~source1[1]) & source2[1];
+  __builtin_memcpy (d, e, sizeof (d));
 
-  if (check_union128d (u, (double *)e))
+  if (check_union128d (u, d))
     abort ();
 }
2021-01-26  Jakub Jelinek  <ja...@redhat.com>

        * gcc.target/i386/m128-check.h (CHECK_EXP): Remove
        optimize ("no-strict-aliasing") attribute.
        * gcc.target/i386/sse-andnps-1.c (TEST): Copy e into float[4]
        array to avoid violating TBAA.
        * gcc.target/i386/sse2-andpd-1.c (TEST): Copy e.d into double[2]
        array to avoid violating TBAA.
        * gcc.target/i386/sse-andps-1.c (TEST): Copy e.f into float[4]
        array to avoid violating TBAA.
        * gcc.target/i386/sse2-andnpd-1.c (TEST): Copy e into double[2]
        array to avoid violating TBAA.

--- gcc/testsuite/gcc.target/i386/m128-check.h.jj       2021-01-22 
22:51:00.000000000 +0100
+++ gcc/testsuite/gcc.target/i386/m128-check.h  2021-01-26 16:56:51.540812730 
+0100
@@ -78,7 +78,6 @@ typedef union
 
 #define CHECK_EXP(UNION_TYPE, VALUE_TYPE, FMT)         \
 static int                                             \
-__attribute__((optimize ("no-strict-aliasing")))       \
 __attribute__((noinline, unused))                      \
 check_##UNION_TYPE (UNION_TYPE u, const VALUE_TYPE *v) \
 {                                                      \
--- gcc/testsuite/gcc.target/i386/sse-andnps-1.c.jj     2020-01-11 
16:31:55.737282972 +0100
+++ gcc/testsuite/gcc.target/i386/sse-andnps-1.c        2021-01-26 
17:11:49.365692113 +0100
@@ -28,6 +28,7 @@ TEST (void)
   int source1[4]={34, 545, 955, 67};
   int source2[4]={67, 4, 57, 897};
   int e[4];
+  float f[4];
    
   s1.x = _mm_loadu_ps ((float *)source1);
   s2.x = _mm_loadu_ps ((float *)source2);
@@ -37,7 +38,8 @@ TEST (void)
   e[1] = (~source1[1]) & source2[1];
   e[2] = (~source1[2]) & source2[2];
   e[3] = (~source1[3]) & source2[3];
+  __builtin_memcpy (f, e, sizeof (f));
 
-  if (check_union128 (u, (float *)e))
+  if (check_union128 (u, f))
     abort ();
 }
--- gcc/testsuite/gcc.target/i386/sse2-andpd-1.c.jj     2020-01-11 
16:31:55.739282942 +0100
+++ gcc/testsuite/gcc.target/i386/sse2-andpd-1.c        2021-01-26 
17:11:11.735116433 +0100
@@ -31,6 +31,7 @@ TEST (void)
     double d[2];
     long long ll[2];
   }source1, source2, e;
+  double d[2];
    
   s1.x = _mm_set_pd (34545, 95567);
   s2.x = _mm_set_pd (674, 57897);
@@ -42,7 +43,8 @@ TEST (void)
    
   e.ll[0] = source1.ll[0] & source2.ll[0];
   e.ll[1] = source1.ll[1] & source2.ll[1];
+  __builtin_memcpy (d, e.d, sizeof (d));
 
-  if (check_union128d (u, e.d))
+  if (check_union128d (u, d))
     abort ();
 }
--- gcc/testsuite/gcc.target/i386/sse-andps-1.c.jj      2020-01-11 
16:31:55.737282972 +0100
+++ gcc/testsuite/gcc.target/i386/sse-andps-1.c 2021-01-26 17:09:51.084025827 
+0100
@@ -30,6 +30,7 @@ TEST (void)
     float f[4];
     int   i[4];
   }source1, source2, e;
+  float f[4];
 
   s1.x = _mm_set_ps (34, 545, 955, 67);
   s2.x = _mm_set_ps (67, 4, 57, 897);
@@ -43,7 +44,8 @@ TEST (void)
   e.i[1] = source1.i[1] & source2.i[1];
   e.i[2] = source1.i[2] & source2.i[2];
   e.i[3] = source1.i[3] & source2.i[3];
+  __builtin_memcpy (f, e.f, sizeof (f));
 
-  if (check_union128 (u, e.f))
+  if (check_union128 (u, f))
     abort ();
 }
--- gcc/testsuite/gcc.target/i386/sse2-andnpd-1.c.jj    2020-01-11 
16:31:55.739282942 +0100
+++ gcc/testsuite/gcc.target/i386/sse2-andnpd-1.c       2021-01-26 
17:09:28.472280788 +0100
@@ -28,6 +28,7 @@ TEST (void)
   long long source1[2]={34545, 95567};
   long long source2[2]={674, 57897};
   long long e[2];
+  double d[2];
    
   s1.x = _mm_loadu_pd ((double *)source1);
   s2.x = _mm_loadu_pd ((double *)source2);
@@ -35,7 +36,8 @@ TEST (void)
    
   e[0] = (~source1[0]) & source2[0];
   e[1] = (~source1[1]) & source2[1];
+  __builtin_memcpy (d, e, sizeof (d));
 
-  if (check_union128d (u, (double *)e))
+  if (check_union128d (u, d))
     abort ();
 }

Reply via email to