aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejas Belagod <tejas.belagod@arm.com>2025-04-11 10:02:28 +0530
committerTejas Belagod <tejas.belagod@arm.com>2025-05-06 11:41:18 +0530
commitc3979346f963adfdc6c860a43103a0768863cbcf (patch)
tree9d7ab20b79d137024cca49b82f50adaa090f7263
parent2572d46f0d1e426c1091f9b84861ee5213b84b5a (diff)
downloadgcc-c3979346f963adfdc6c860a43103a0768863cbcf.zip
gcc-c3979346f963adfdc6c860a43103a0768863cbcf.tar.gz
gcc-c3979346f963adfdc6c860a43103a0768863cbcf.tar.bz2
libgomp: Update SVE test
Fix udr-sve.c target test that to check for the correct results based on the OpenMP clauses used. The test was first written with a misunderstood functionality of the reduction clause. Tested with aarch64-linux-gnu. OK for trunk? libgomp/ChangeLog: * testsuite/libgomp.c-target/aarch64/udr-sve.c: Fix test.
-rw-r--r--libgomp/testsuite/libgomp.c-target/aarch64/udr-sve.c58
1 files changed, 47 insertions, 11 deletions
diff --git a/libgomp/testsuite/libgomp.c-target/aarch64/udr-sve.c b/libgomp/testsuite/libgomp.c-target/aarch64/udr-sve.c
index 03d93cc..02e02dc 100644
--- a/libgomp/testsuite/libgomp.c-target/aarch64/udr-sve.c
+++ b/libgomp/testsuite/libgomp.c-target/aarch64/udr-sve.c
@@ -9,8 +9,8 @@
void __attribute__ ((noipa))
parallel_reduction ()
{
- int a[8] = {1 ,1, 1, 1, 1, 1, 1, 1};
- int b[8] = {0 ,0, 0, 0, 0, 0, 0, 0};
+ int a[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ int b[8] = {0, 0, 0, 0, 0, 0, 0, 0};
svint32_t va = svld1_s32 (svptrue_b32 (), b);
int i = 0;
int64_t res;
@@ -30,8 +30,8 @@ parallel_reduction ()
void __attribute__ ((noipa))
for_reduction ()
{
- int a[8] = {1 ,1, 1, 1, 1, 1, 1, 1};
- int b[8] = {0 ,0, 0, 0, 0, 0, 0, 0};
+ int a[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ int b[8] = {0, 0, 0, 0, 0, 0, 0, 0};
svint32_t va = svld1_s32 (svptrue_b32 (), b);
int j;
int64_t res;
@@ -58,13 +58,13 @@ simd_reduction ()
for (j = 0; j < 8; j++)
a[j] = 1;
- #pragma omp simd reduction (+:va, i)
+ #pragma omp simd reduction (+:va)
for (j = 0; j < 16; j++)
- va = svld1_s32 (svptrue_b32 (), a);
+ va += svld1_s32 (svptrue_b32 (), a);
res = svaddv_s32 (svptrue_b32 (), va);
- if (res != 8)
+ if (res != 128)
__builtin_abort ();
}
@@ -72,22 +72,57 @@ void __attribute__ ((noipa))
inscan_reduction_incl ()
{
svint32_t va = svindex_s32 (0, 0);
+ int a[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ int b[64] = { 0 };
int j;
int64_t res = 0;
- #pragma omp parallel
- #pragma omp for reduction (inscan,+:va) firstprivate (res) lastprivate (res)
+ #pragma omp parallel for reduction (inscan, +:va)
for (j = 0; j < 8; j++)
{
- va = svindex_s32 (1, 0);
+ va += svld1_s32 (svptrue_b32 (), a);
#pragma omp scan inclusive (va)
- res += svaddv_s32 (svptrue_b32 (), va);
+ svst1_s32 (svptrue_b32 (), b + j * 8, va);
+ }
+
+ res = svaddv_s32 (svptrue_b32 (), va);
+
+ if (res != 64)
+ __builtin_abort ();
+
+ for (j = 0; j < 64; j+=8)
+ if (b[j] != (j / 8 + 1))
+ __builtin_abort ();
+}
+
+void __attribute__ ((noipa))
+inscan_reduction_excl ()
+{
+ svint32_t va = svindex_s32 (0, 0);
+ int a[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ int b[64] = { 0 };
+ int j;
+ int64_t res = 0;
+
+ #pragma omp parallel for reduction (inscan, +:va)
+ for (j = 0; j < 8; j++)
+ {
+ svst1_s32 (svptrue_b32 (), b + j * 8, va);
+ #pragma omp scan exclusive (va)
+ va += svld1_s32 (svptrue_b32 (), a);
}
+ res = svaddv_s32 (svptrue_b32 (), va);
+
if (res != 64)
__builtin_abort ();
+
+ for (j = 0; j < 64; j+=8)
+ if (b[j] != j / 8)
+ __builtin_abort ();
}
+
int
main ()
{
@@ -95,4 +130,5 @@ main ()
for_reduction ();
simd_reduction ();
inscan_reduction_incl ();
+ inscan_reduction_excl ();
}