]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[x86] Adjust gcc.target/i386/vect-epilogues-2.c and vect-pr113078.c
authorRichard Biener <rguenther@suse.de>
Wed, 29 Apr 2026 09:07:06 +0000 (11:07 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 30 Apr 2026 06:12:46 +0000 (08:12 +0200)
The following adjusts two very similar testcases that when
vector cost comparison is enabled and with generic tuning,
chose to use SSE vector size for the vector epilogue as that
reduces the possible iterations through the scalar epilogue
following that and thus speeds up the overall epilogue processing
for a majority of cases.  I have chosen to duplicate the
testcases for --param ix86-vect-compare-costs=0 and =1.

* gcc.target/i386/vect-epilogues-2.c: Add
--param ix86-vect-compare-costs=0.
* gcc.target/i386/vect-epilogues-2b.c: Duplicate from
gcc.target/i386/vect-epilogues-2.c, add
--param ix86-vect-compare-costs=1 and adjust expected
vectorization.
* gcc.target/i386/vect-pr113078.c: Likewise.
* gcc.target/i386/vect-pr113078b.c: Likewise.

gcc/testsuite/gcc.target/i386/vect-epilogues-2.c
gcc/testsuite/gcc.target/i386/vect-epilogues-2b.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/vect-pr113078.c
gcc/testsuite/gcc.target/i386/vect-pr113078b.c [new file with mode: 0644]

index d6c06edcacd1b481388439fb15253064f651701e..52bdade7e3b47743d46f6ac1a534ffc7bcd95dd2 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O3 -mavx512bw -mtune=generic -fdump-tree-vect-optimized" } */
+/* { dg-options "-O3 -mavx512bw -mtune=generic --param ix86-vect-compare-costs=0 -fdump-tree-vect-optimized" } */
 
 int test (signed char *data, int n)
 {
diff --git a/gcc/testsuite/gcc.target/i386/vect-epilogues-2b.c b/gcc/testsuite/gcc.target/i386/vect-epilogues-2b.c
new file mode 100644 (file)
index 0000000..4a58dc6
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512bw -mtune=generic --param ix86-vect-compare-costs=1 -fdump-tree-vect-optimized" } */
+
+int test (signed char *data, int n)
+{
+  int sum = 0;
+  for (int i = 0; i < n; ++i)
+    sum += data[i];
+  return sum;
+}
+
+/* { dg-final { scan-tree-dump "loop vectorized using 64 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump-not "loop vectorized using 32 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 8 byte vectors" "vect" { target { ! ia32 } } } } */
index e7666054324779140599b55e8435d599a30384a2..3a1235f6426533d51277c1529d774fe1cefce600 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O3 -mavx512vl" } */
+/* { dg-options "-O3 -mavx512vl --param ix86-vect-compare-costs=0" } */
 
 int
 foo (int n, int* p, int* pi)
diff --git a/gcc/testsuite/gcc.target/i386/vect-pr113078b.c b/gcc/testsuite/gcc.target/i386/vect-pr113078b.c
new file mode 100644 (file)
index 0000000..a60f3bb
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512vl -mtune=generic --param ix86-vect-compare-costs=1" } */
+
+int
+foo (int n, int* p, int* pi)
+{
+  int sum = 0;
+  for (int i = 0; i != n; i++)
+    {
+      if (pi[i] > 0)
+       sum -= p[i];
+    }
+  return sum;
+}
+
+/* We vectorize with 64 byte vectors and 16 byte vector epilog which
+   we completely peel.  */
+/* { dg-final { scan-assembler-times "vpsub\[^\r\n\]*%k" 4 } } */