On Thu, Apr 03, 2025 at 12:07:54PM +0530, Tejas Belagod wrote: > Add AArch64 SVE target exectute tests to test various workshare constructs and > clauses with SVE types. > > libgomp/ChangeLog: > > * testsuite/libgomp.c-target/aarch64/aarch64.exp: Test driver. > * testsuite/libgomp.c-target/aarch64/firstprivate.c: New test. > * testsuite/libgomp.c-target/aarch64/lastprivate.c: Likewise. > * testsuite/libgomp.c-target/aarch64/private.c: Likewise. > * testsuite/libgomp.c-target/aarch64/shared.c: Likewise. > * testsuite/libgomp.c-target/aarch64/simd-aligned.c: Likewise. > * testsuite/libgomp.c-target/aarch64/simd-nontemporal.c: Likewise. > * testsuite/libgomp.c-target/aarch64/threadprivate.c: Likewise. > * testsuite/libgomp.c-target/aarch64/udr-sve.c: Likewise.
> --- /dev/null > +++ b/libgomp/testsuite/libgomp.c-target/aarch64/firstprivate.c > @@ -0,0 +1,128 @@ > +/* { dg-do run { target aarch64_sve256_hw } } */ > +/* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */ > + > +#include <arm_sve.h> > + > +extern int omp_get_thread_num (void); In libgomp tests please just #include <omp.h> instead of declaring OpenMP APIs yourself. > +void __attribute__ ((noipa)) s/ / / > +omp_firstprivate_sections () What I said earlier about function names, please avoid omp_ prefixes (everywhere) for your own functions. > +void __attribute__ ((noipa)) > +omp_firstprivate_distribute () > +{ > + Why the newline before variable declarations? > + int a[32], b[32], c[32]; > + svint32_t va, vb, vc; > + int i; > +int > +main() s/main/main / > +extern int omp_get_thread_num (void); See above. > +#pragma omp parallel sections lastprivate (vb, vc) num_threads (2) > + { > + #pragma omp section > + vb = svld1_s32 (svptrue_b32 (), b); > + #pragma omp section > + vc = svld1_s32 (svptrue_b32 (), c); > + } > + > + va = svadd_s32_z (svptrue_b32 (), vb, vc); This is not correct. lastprivate acts as private and then copies back value from the last section (or last loop iteration). vc will be correctly copied here as it is set in the last section, but whether you get the vb from the first section or uninitialized value depends on if both sections are scheduled to the same thread or different thread. So you can't use vb after the loop, better just make it private (vb) lastprivate (vc). Or do #pragma omp section vb = svld1_s32 (svptrue_b32 (), b); #pragma omp section vb = svld1_s32 (svptrue_b32 (), b); vc = svld1_s32 (svptrue_b32 (), c); > +int main () s/int /int\n/ > +{ > + > + svint32_t ones __attribute__((aligned(128))) = svindex_s32 (1, 0); > + > + for (int i = 0;i < N; i++) s/;i/; i/ > +__attribute((noipa)) s/((/ ((/ > +void foo (int *p, int *q) s/void /void\n/ > + > + return; > +} Why the return; in there? > + > +int > +main() > +{ > + int64_t res = 0; > + > +#pragma omp parallel firstprivate (res) num_threads(10) > + { > + vec1 = svindex_s32 (1, 0); > + res = svaddv_s32 (svptrue_b32 (), vec1); > + > +#pragma omp barrier > + if (res != 8LL) > + __builtin_abort (); > + } > + > + foo (); > + > + return 0; And return 0; isn't needed in main as well now that all the tests are C23... Jakub