From: Richard Sandiford Date: Thu, 3 Feb 2022 10:44:01 +0000 (+0000) Subject: aarch64: Adjust tests after fix for PR102659 X-Git-Tag: upstream/12.2.0~1678 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b4044d8c271d22407d6d34caf625380daaa14b4;p=platform%2Fupstream%2Fgcc.git aarch64: Adjust tests after fix for PR102659 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. --- diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_1.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_1.c index 03b2b93..450fbb8 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_1.c @@ -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]; \ } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_2.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_2.c index 87ac317..499abd7 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_2.c @@ -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] \ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_3.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_3.c index 54806f9..a5ce071 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_3.c @@ -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] \ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_4.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_4.c index 4c73004f..bdfea96 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_4.c @@ -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]; \ } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_5.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_5.c index 2a33ee8..299955a 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_5.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_5.c @@ -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]; \ } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_6.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_6.c index d4542ec..999c7b5 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_6.c @@ -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]; \ } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_7.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_7.c index 9d26e15..57d71ed 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_7.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_7.c @@ -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]; \ } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_8.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_8.c index 17fd4c0..1ead3ba 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_8.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_8.c @@ -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]; \ } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_1.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_1.c index a75a694..39fae68 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_1.c @@ -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]) \ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_2.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_2.c index 0fd35f2..0fe9b99 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_2.c @@ -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]) \ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_3.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_3.c index 1765d54..a943087 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_3.c @@ -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]) \ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_4.c b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_4.c index 59e9ee4..d3f0216 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_4.c @@ -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) \