[committed] testsuite: Add testcase for recently fixed PR [PR114075]

Message ID Zd8Qbgq9EKsUkaxS@tucnak
State Accepted
Headers
Series [committed] testsuite: Add testcase for recently fixed PR [PR114075] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jakub Jelinek Feb. 28, 2024, 10:52 a.m. UTC
  Hi!

This adds testcase from PR114075 which has been fixed by the r14-9205
change on s390x-linux with -march=z13.

Tested on x86_64-linux -m32/-m64 and using a cross to s390x-linux
before/after r14-9205 with subsequent execution on s390x hw.
Committed to trunk as obvious.

2024-02-28  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/114075
	* gcc.dg/gomp/pr114075.c: New test.


	Jakub
  

Patch

--- gcc/testsuite/gcc.dg/gomp/pr114075.c.jj	2024-02-28 11:37:52.370765940 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr114075.c	2024-02-28 11:38:58.080850058 +0100
@@ -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 ();
+    }
+}