Hi!

Starting with r15-4225 the loop in foo1 is vectorized even at -O2 and that
implies later some small unrolling, regardless of -funroll-loops flag being
added in
#pragma GCC optimize("O3,unroll-loops")
only for foo2.
My understanding of the intent of the test was that before r12-5920 test the
backend caused -funroll-loops to be set even for foo1 despite the pragma
only appeared after it and the test just wanted to make sure unrolling is
done just in the function with -funroll-loops.
Now, seems the unrolling was happening with -O2 -fno-tree-vectorize as well,
the test would have FAILed with the following patch before r12-5920 and
PASSes since r12-5920 the same as with -O2, except that it still PASSes even
starting with r15-4225.

Tested with x86_64-linux -> powerpc64le-linux cross, ok for trunk?

2025-03-06  Jakub Jelinek  <ja...@redhat.com>

        PR target/117207
        PR target/103515
        * gcc.target/powerpc/pr103515.c: Add -fno-tree-vectorize to
        dg-options.

--- gcc/testsuite/gcc.target/powerpc/pr103515.c.jj      2022-01-11 
23:11:23.207278673 +0100
+++ gcc/testsuite/gcc.target/powerpc/pr103515.c 2025-03-06 15:57:48.507247453 
+0100
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-rtl-loop2_unroll-optimized" } */
+/* { dg-options "-O2 -fno-tree-vectorize -fdump-rtl-loop2_unroll-optimized" } 
*/
 
 /* The pragma specified for foo2 should not affect foo1.
    Verify compiler won't perform unrolling for foo1.  */

        Jakub

Reply via email to