From db465230cccf0844e803dd6701756054fe97244a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 28 Feb 2024 11:49:29 +0100 Subject: [PATCH] testsuite: Add testcase for recently fixed PR [PR114075] This adds testcase from PR114075 which has been fixed by the r14-9205 change on s390x-linux with -march=z13. 2024-02-28 Jakub Jelinek PR tree-optimization/114075 * gcc.dg/gomp/pr114075.c: New test. --- gcc/testsuite/gcc.dg/gomp/pr114075.c | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr114075.c diff --git a/gcc/testsuite/gcc.dg/gomp/pr114075.c b/gcc/testsuite/gcc.dg/gomp/pr114075.c new file mode 100644 index 000000000000..c5c9cda9ea9b --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr114075.c @@ -0,0 +1,31 @@ +/* PR tree-optimization/114075 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fopenmp-simd -Wno-psabi" } */ + +typedef float V __attribute__((__vector_size__ (16))); + +__attribute__((__always_inline__)) inline static float +foo (V a) +{ + float r = 0; +#pragma omp simd reduction(+:r) + for (unsigned long i = 0; i < (sizeof (a) / sizeof (float)); i++) + r += a[i]; + return r; +} + +int +main () +{ + static const struct { V a; float r; } t[] = { + { (V) { -17.0f, -18.0f, -19.0f, 20.0f }, -34.0f }, + { (V) { 18.5f, 19.125f, 20.5f, -38.25f }, 19.875f }, + { (V) { -8.25f, 16.75f, -42.5f, -18.75f }, -52.75f } + }; + for (unsigned long i = 0; i < (sizeof (t) / sizeof (t[0])); i++) + { + float r = foo (t[i].a); + if (r != t[i].r) + __builtin_abort (); + } +} -- 2.47.2