public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-6917] testsuite: Fix TBAA in sse*and*p[sd]*.c tests
Date: Tue, 26 Jan 2021 19:04:30 +0000 (GMT)	[thread overview]
Message-ID: <20210126190430.46808385802A@sourceware.org> (raw)

https://gcc.gnu.org/g:e80f1f6b7a339bce1db03567e497658ae32d135e

commit r11-6917-ge80f1f6b7a339bce1db03567e497658ae32d135e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jan 26 20:02:29 2021 +0100

    testsuite: Fix TBAA in sse*and*p[sd]*.c tests
    
    This patch drops the no-strict-aliasing hack in m128-check.h and instead
    ensures the tests read objects with the right dynamic type.
    
    2021-01-26  Jakub Jelinek  <jakub@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.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/m128-check.h    | 1 -
 gcc/testsuite/gcc.target/powerpc/sse-andnps-1.c  | 4 +++-
 gcc/testsuite/gcc.target/powerpc/sse-andps-1.c   | 4 +++-
 gcc/testsuite/gcc.target/powerpc/sse2-andnpd-1.c | 4 +++-
 gcc/testsuite/gcc.target/powerpc/sse2-andpd-1.c  | 4 +++-
 5 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/m128-check.h b/gcc/testsuite/gcc.target/powerpc/m128-check.h
index 50e4330aab6..a3088e0c247 100644
--- a/gcc/testsuite/gcc.target/powerpc/m128-check.h
+++ b/gcc/testsuite/gcc.target/powerpc/m128-check.h
@@ -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)	\
 {							\
diff --git a/gcc/testsuite/gcc.target/powerpc/sse-andnps-1.c b/gcc/testsuite/gcc.target/powerpc/sse-andnps-1.c
index 3b45ca43496..9851621de37 100644
--- a/gcc/testsuite/gcc.target/powerpc/sse-andnps-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/sse-andnps-1.c
@@ -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 ();
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/sse-andps-1.c b/gcc/testsuite/gcc.target/powerpc/sse-andps-1.c
index a35dc711e4b..3a636669dee 100644
--- a/gcc/testsuite/gcc.target/powerpc/sse-andps-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/sse-andps-1.c
@@ -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 ();
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/sse2-andnpd-1.c b/gcc/testsuite/gcc.target/powerpc/sse2-andnpd-1.c
index 1a0e6cb11d4..747bcc9387a 100644
--- a/gcc/testsuite/gcc.target/powerpc/sse2-andnpd-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/sse2-andnpd-1.c
@@ -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 ();
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/sse2-andpd-1.c b/gcc/testsuite/gcc.target/powerpc/sse2-andpd-1.c
index 4a069518f4f..5034bf9f5fa 100644
--- a/gcc/testsuite/gcc.target/powerpc/sse2-andpd-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/sse2-andpd-1.c
@@ -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 ();
 }


                 reply	other threads:[~2021-01-26 19:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210126190430.46808385802A@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).