Hi,

These test fail for arm-none-eabi with -mcpu=cortex-a7 -mfloat-abi=hard 
-mfpu=auto.

Should the tests include the following line

/* { dg-warning "'-fassociative-math' disabled" "" { target *-*-* } 0 } */

or something similar to remove the warning (above line is from 
gcc.dg/tree-ssa/pr23109.c)?

This is what I see in my logs:

Testing vect/vect-ifcvt-15.c
doing compile
Executing on host: /build/r17-2833-g32657f29f91871/bin/arm-none-eabi-gcc  
/build/gcc_src/gcc/testsuite/gcc.dg/vect/vect-ifcvt-15.c  -mthumb -march=armv7ve+simd 
-mcpu=cortex-a7 -mfloat-abi=hard -mfpu=auto   -dumpbase "" 
-fdiagnostics-plain-output   -ffast-math -ftree-vectorize 
-fno-tree-loop-distribute-patterns -fno-vect-cost-model -fno-common -O2 
-fdump-tree-vect-details -ftrapping-math      --specs=rdimon.specs -Wl,--start-group -lc 
-lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition 
-Wl,-u,_isatty,-u,_fstat  -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort 
-Wl,gcc_tg.o -lm -T qemu.ld -o ./vect-ifcvt-15.exe    (timeout = 800)
...
 status 0
FAIL: gcc.dg/vect/vect-ifcvt-15.c (test for excess errors)
Excess errors:
cc1: warning: '-fassociative-math' disabled; other options take precedence


Kind regards,
Torbjörn

On 2026-07-11 02:00, Andrew Pinski wrote:
These were originally renamed to no-trapping-math-vect-*.c in 
r0-87196-g04b03edb56633f
but were fixed in r0-107313-gf9613c9a919462 but never added back to the
trapping versions.
This adds them back this time with an explict -ftrapping-math.  Note 
vect-ifcvt-11.c
already exists now so need to name it vect-ifcvt-11a.c.

Committed as obvious after testing these testcases work on x86_64-linux-gnu.

        PR testsuite/36190

gcc/testsuite/ChangeLog:

        * gcc.dg/vect/vect-111.c: New test.
        * gcc.dg/vect/vect-ifcvt-11a.c: New test.
        * gcc.dg/vect/vect-ifcvt-12.c: New test.
        * gcc.dg/vect/vect-ifcvt-13.c: New test.
        * gcc.dg/vect/vect-ifcvt-14.c: New test.
        * gcc.dg/vect/vect-ifcvt-15.c: New test.

Signed-off-by: Andrew Pinski <[email protected]>
---
  gcc/testsuite/gcc.dg/vect/vect-111.c       | 40 ++++++++++++++++++++++
  gcc/testsuite/gcc.dg/vect/vect-ifcvt-11a.c | 34 ++++++++++++++++++
  gcc/testsuite/gcc.dg/vect/vect-ifcvt-12.c  | 33 ++++++++++++++++++
  gcc/testsuite/gcc.dg/vect/vect-ifcvt-13.c  | 34 ++++++++++++++++++
  gcc/testsuite/gcc.dg/vect/vect-ifcvt-14.c  | 34 ++++++++++++++++++
  gcc/testsuite/gcc.dg/vect/vect-ifcvt-15.c  | 34 ++++++++++++++++++
  6 files changed, 209 insertions(+)
  create mode 100644 gcc/testsuite/gcc.dg/vect/vect-111.c
  create mode 100644 gcc/testsuite/gcc.dg/vect/vect-ifcvt-11a.c
  create mode 100644 gcc/testsuite/gcc.dg/vect/vect-ifcvt-12.c
  create mode 100644 gcc/testsuite/gcc.dg/vect/vect-ifcvt-13.c
  create mode 100644 gcc/testsuite/gcc.dg/vect/vect-ifcvt-14.c
  create mode 100644 gcc/testsuite/gcc.dg/vect/vect-ifcvt-15.c

diff --git a/gcc/testsuite/gcc.dg/vect/vect-111.c 
b/gcc/testsuite/gcc.dg/vect/vect-111.c
new file mode 100644
index 00000000000..a8a6d15aa1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-111.c
@@ -0,0 +1,40 @@
+/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "-ftrapping-math" } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+
+__attribute__ ((noinline)) int
+main1 (void)
+{
+  int i;
+  float a[N];
+
+  /* Condition in loop.  */
+  /* This loop is vectorized on platforms that support vect_condition.  */
+  for (i = 0; i < N; i++)
+  {
+    a[i] = (b[i] > 0 ? b[i] : 0);
+  }
+
+#pragma GCC novector
+  for (i = 0; i < N; i++)
+  {
+    if (a[i] != b[i])
+       abort ();
+  }
+  return 0;
+}
+
+int main (void)
+{
+  check_vect ();
+  return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target 
powerpc*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target 
i?86-*-* x86_64-*-* ia64-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-11a.c 
b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-11a.c
new file mode 100644
index 00000000000..a7f2f93a614
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-11a.c
@@ -0,0 +1,34 @@
+/* { dg-require-effective-target vect_condition } */
+/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "-fno-trapping-math" } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define MAX 42
+
+float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
+float B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0};
+
+extern void abort(void);
+
+int main ()
+{
+  int i, j;
+
+  check_vect ();
+
+  for (i = 0; i < 16; i++)
+    A[i] = ( A[i] >= MAX ? MAX : 0);
+
+  /* check results:  */
+#pragma GCC novector
+  for (i = 0; i < N; i++)
+    if (A[i] != B[i])
+      abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-12.c 
b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-12.c
new file mode 100644
index 00000000000..b8418dd5a4e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-12.c
@@ -0,0 +1,33 @@
+/* { dg-require-effective-target vect_condition } */
+/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "-ftrapping-math" } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define MAX 42
+
+float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
+float B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0};
+
+extern void abort(void);
+
+int main ()
+{
+  int i, j;
+
+  check_vect ();
+  for (i = 0; i < 16; i++)
+    A[i] = ( A[i] > MAX ? MAX : 0);
+
+  /* check results:  */
+#pragma GCC novector
+  for (i = 0; i < N; i++)
+    if (A[i] != B[i])
+      abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-13.c 
b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-13.c
new file mode 100644
index 00000000000..3a62c8cadba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-13.c
@@ -0,0 +1,34 @@
+/* { dg-require-effective-target vect_condition } */
+/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "-ftrapping-math" } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define MAX 42
+
+float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
+float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
+
+extern void abort(void);
+
+int main ()
+{
+  int i, j;
+
+  check_vect ();
+
+  for (i = 0; i < 16; i++)
+    A[i] = ( A[i] <= MAX ? MAX : 0);
+
+  /* check results:  */
+#pragma GCC novector
+  for (i = 0; i < N; i++)
+    if (A[i] != B[i])
+      abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-14.c 
b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-14.c
new file mode 100644
index 00000000000..3a62c8cadba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-14.c
@@ -0,0 +1,34 @@
+/* { dg-require-effective-target vect_condition } */
+/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "-ftrapping-math" } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define MAX 42
+
+float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
+float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42};
+
+extern void abort(void);
+
+int main ()
+{
+  int i, j;
+
+  check_vect ();
+
+  for (i = 0; i < 16; i++)
+    A[i] = ( A[i] <= MAX ? MAX : 0);
+
+  /* check results:  */
+#pragma GCC novector
+  for (i = 0; i < N; i++)
+    if (A[i] != B[i])
+      abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-15.c 
b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-15.c
new file mode 100644
index 00000000000..3180b36eb78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-15.c
@@ -0,0 +1,34 @@
+/* { dg-require-effective-target vect_condition } */
+/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "-ftrapping-math" } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define MAX 42
+
+float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11};
+float B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42};
+
+extern void abort(void);
+
+int main ()
+{
+  int i, j;
+
+  check_vect ();
+
+  for (i = 0; i < 16; i++)
+    A[i] = ( A[i] < MAX ? MAX : 0);
+
+  /* check results:  */
+#pragma GCC novector
+  for (i = 0; i < N; i++)
+    if (A[i] != B[i])
+      abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */

Reply via email to