Hi,

Some targets (aarch64 and x86_64 with multilib) reported regression for some
test cases made for PR104116. Turned out an extra loop which was for checking
results in run-time was also being vectorized and the count of vect loop was 2
instead of 1. In this patch I have made sure no other loop other than the one
in interest of test case is vectorized. Ok for master?

Thanks and regards,
Avinash Jayakar

The commit gcc-16-4464-g6883d51304f added 30 new tests for testing
vectorization of {FLOOR,MOD,ROUND}_{DIV,MOD}_EXPR. Few of them failed
for certain targets due to the vectorization of runtime-check loop which
was not intended.
This patch disables optimization for all of the run-time check loops so
that the count of vectorized loop is always 1.

2025-10-21  Avinash Jayakar  <[email protected]>

gcc/testsuite/ChangeLog:
        PR target/104116
        * gcc.dg/vect/pr104116.h: disable optimizations.
---
 gcc/testsuite/gcc.dg/vect/pr104116.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/vect/pr104116.h 
b/gcc/testsuite/gcc.dg/vect/pr104116.h
index 6f14e4b3103..2e039e14677 100644
--- a/gcc/testsuite/gcc.dg/vect/pr104116.h
+++ b/gcc/testsuite/gcc.dg/vect/pr104116.h
@@ -106,6 +106,7 @@ int cl_div (int x, int y)
   return q;
 }
 
+__attribute__((optimize("O0")))
 unsigned int cl_udiv (unsigned int x, unsigned int y)
 {
   unsigned int r = x % y;
@@ -123,6 +124,7 @@ int cl_mod (int x, int y)
   return r;
 }
 
+__attribute__((optimize("O0")))
 unsigned int cl_umod (unsigned int x, unsigned int y)
 {
   unsigned int r = x % y;
@@ -141,7 +143,7 @@ int fl_div (int x, int y)
   return q;
 }
 
-
+__attribute__((optimize("O0")))
 int fl_mod (int x, int y)
 {
   int r = x % y;
@@ -150,12 +152,14 @@ int fl_mod (int x, int y)
   return r;
 }
 
+__attribute__((optimize("O0")))
 int abs(int x)
 {
   if (x < 0) return -x;
   return x;
 }
 
+__attribute__((optimize("O0")))
 int rd_mod (int x, int y)
 {
   int r = x % y;
@@ -169,6 +173,7 @@ int rd_mod (int x, int y)
   return r;
 }
 
+__attribute__((optimize("O0")))
 int rd_div (int x, int y)
 {
   int r = x % y;
@@ -183,6 +188,7 @@ int rd_div (int x, int y)
   return q;
 }
 
+__attribute__((optimize("O0")))
 unsigned int rd_umod (unsigned int x, unsigned int y)
 {
   unsigned int r = x % y;
@@ -191,6 +197,7 @@ unsigned int rd_umod (unsigned int x, unsigned int y)
   return r;
 }
 
+__attribute__((optimize("O0")))
 unsigned int rd_udiv (unsigned int x, unsigned int y)
 {
   unsigned int r = x % y;
-- 
2.51.0

Reply via email to