aarch64: Adjust tests after fix for PR102659
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 3 Feb 2022 10:44:01 +0000 (10:44 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 3 Feb 2022 10:44:01 +0000 (10:44 +0000)
After the fix for PR102659, the vectoriser can no longer group
conditional accesses of the form:

  for (int i = 0; i < n; ++i)
    if (...)
      ...a[i * 2] + a[i * 2 + 1]...;

on LP64 targets.  It has to treat them as two independent
gathers instead.

This was causing failures in the sve mask_struct*.c tests.
The tests weren't really testing that int iterators could
be used, so this patch switches to pointer-sized iterators
instead.

gcc/testsuite/
* gcc.target/aarch64/sve/mask_struct_load_1.c: Use intptr_t
iterators instead of int iterators.
* gcc.target/aarch64/sve/mask_struct_load_2.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_3.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_4.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_5.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_6.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_7.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_8.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_1.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_2.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_3.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_4.c: Likewise.

12 files changed:
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_1.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_2.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_3.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_4.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_5.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_6.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_7.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_8.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_1.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_2.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_3.c
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_4.c

index 03b2b93df07b8ccb90ac394b3ae1ba89777cc916..450fbb887e39f5f8f33b43769f1c5197f249f48f 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_2 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = src[i * 2] + src[i * 2 + 1];                  \
   }
index 87ac3178be02b9dd29c7aab2066e9824a29ac204..499abd7c99a1c5cd3d255eacd86b2a74f8b9673e 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_3 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = (src[i * 3]                                   \
                   + src[i * 3 + 1]                             \
index 54806f93ad9b86bdd39e5ea23ce3807dbd600623..a5ce0716322dabe4ac5161bef2144fe066e1b9c4 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_4 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = (src[i * 4]                                   \
                   + src[i * 4 + 1]                             \
index 4c73004f68dfa980998fded7bc3a4e038affca1c..bdfea964f88a1dd456302756086237b823bd405c 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_3 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = src[i * 3] + src[i * 3 + 2];                  \
   }
index 2a33ee81d1ab1e8d3b4a8a2785ac96216ed25f5a..299955a8a93d948d0d10ad22bb8ffa44e2eae486 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_4 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = src[i * 4] + src[i * 4 + 3];                  \
   }
index d4542eca0f787eb4e0137860939f64a05ac63b6b..999c7b52422db2f2befe798e174645f0220f1307 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_2 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = src[i * 2];                                   \
   }
index 9d26e15c0d9883f275f565b4138f29cfb08e9c81..57d71ed460a7087a1deb0c407f8c86362e0eef77 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_3 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = src[i * 3] + src[i * 3 + 1];                  \
   }
index 17fd4c0a079345a2e483f99d923266999e8cf5c5..1ead3ba695e6724d4ac692c2a3003cd356874ad8 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_4 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       if (cond[i])                                             \
        dest[i] = src[i * 4] + src[i * 4 + 2];                  \
   }
index a75a694f9c38cf17675263f98d91a40c5e591189..39fae68a5d02ad713ae9fa662f1ef08a8463fd78 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_2 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, INTYPE bias, int n)      \
+           MASKTYPE *__restrict cond, INTYPE bias, intptr_t n) \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       {                                                                \
        INTYPE value = src[i] + bias;                           \
        if (cond[i])                                            \
index 0fd35f2ff52474e8e54324de0ca482fec0de51d0..0fe9b9934029a32281d53a5e1628a54054823b1d 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_3 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, INTYPE bias, int n)      \
+           MASKTYPE *__restrict cond, INTYPE bias, intptr_t n) \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       {                                                                \
        INTYPE value = src[i] + bias;                           \
        if (cond[i])                                            \
index 1765d54a483e76984af52b9f6f779b693965c035..a9430870eee20457a5c75a9b6b379c98b9d4eed1 100644 (file)
@@ -6,9 +6,9 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_4 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, INTYPE bias, int n)      \
+           MASKTYPE *__restrict cond, INTYPE bias, intptr_t n) \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       {                                                                \
        INTYPE value = src[i] + bias;                           \
        if (cond[i])                                            \
index 59e9ee49c4a214b731ed1975da0dcfa46c059f8b..d3f0216406dee1fa9d91b66833883922a43dd42e 100644 (file)
@@ -6,15 +6,15 @@
 #define TEST_LOOP(NAME, OUTTYPE, INTYPE, MASKTYPE)             \
   void __attribute__ ((noinline, noclone))                     \
   NAME##_2 (OUTTYPE *__restrict dest, INTYPE *__restrict src,  \
-           MASKTYPE *__restrict cond, int n)                   \
+           MASKTYPE *__restrict cond, intptr_t n)              \
   {                                                            \
-    for (int i = 0; i < n; ++i)                                        \
+    for (intptr_t i = 0; i < n; ++i)                           \
       {                                                                \
        if (cond[i] < 8)                                        \
          dest[i * 2] = src[i];                                 \
        if (cond[i] > 2)                                        \
          dest[i * 2 + 1] = src[i];                             \
-       }                                                       \
+      }                                                                \
   }
 
 #define TEST2(NAME, OUTTYPE, INTYPE) \