On Fri, Jul 17, 2026 at 5:22 PM Richard Biener <[email protected]> wrote: > > The following implements BB reduction epilog handling for two-lane > vectors with lane extracts. This allows targets to omit defining > reduc_*_scal optabs for two lane vector modes and enables trivial > handling of in-order reductions with two lanes. The former is > one issue we run into with PR126028 on x86_64. > > This causes some no-op vectorization since we now accept vector > costs equal to scalar costs. > > For gcc.target/i386/pr54400.c this shows that after SLP vectorizing > a two lane reduction we are no longer able to match up the x86 haddpd > instruction I have sent a partial x86 backend fix. > For g++.target/i386/pr114187.C it shows the usual > argument/return costing difficulties but also a too broad testcase > and inadverted coverage of -m32 - I have adjusted the testcase. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. I'll push > this once the x86 prerequesite has landed. > > Richard. > > PR tree-optimization/126028 > * tree-vect-slp.cc (vect_slp_check_for_roots): Move > fold-left reduction check ... > (vectorizable_bb_reduc_epilogue): ... here and allow > two reduction lanes to be unaffected. Handle the two > vector lane without target support for the reduction. > (vectorize_slp_instance_root_stmt): Implement manual two-lane > reduction. > > * gcc.dg/vect/bb-slp-reduc-1.c: New testcase for a two-lane > in-order reduction. > * c-c++-common/vector-subscript-4.c: Use -fno-vectorize. > * g++.target/i386/pr114187.C: Narrow pattern to better > only catch the reported issue.
After commit fb0838bc1073aa5f22ec38e0cca2d70d625c6d71 Author: Richard Biener <[email protected]> Date: Wed Jul 15 10:37:57 2026 +0200 Support two-lane vector BB reductions without target support we may vectorize gcc.target/i386/pr27827.c and gcc.target/i386/pr50038.c with -march=native and $ make check-gcc RUNTESTFLAGS="--target_board='unix{-m32\ -march=native,-march=native}' get FAIL: gcc.target/i386/pr27827.c scan-assembler fmul[ \t]*%st FAIL: gcc.target/i386/pr50038.c scan-assembler-times movzbl 2 Since these 2 tests don't use SEE instructions originally, compile them with -mno-sse to avoid test failures. PR tree-optimization/126028 * gcc.target/i386/pr27827.c: Compile with -mno-sse. * gcc.target/i386/pr50038.c: Likewise. -- H.J.
From 4ca65f35f72689574618d22878b3de263948a8a4 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" <[email protected]> Date: Sat, 25 Jul 2026 14:26:41 +0800 Subject: [PATCH] gcc.target/i386/pr[27827|50038].c: Compile -mno-sse After commit fb0838bc1073aa5f22ec38e0cca2d70d625c6d71 Author: Richard Biener <[email protected]> Date: Wed Jul 15 10:37:57 2026 +0200 Support two-lane vector BB reductions without target support we may vectorize gcc.target/i386/pr27827.c and gcc.target/i386/pr50038.c with -march=native and $ make check-gcc RUNTESTFLAGS="--target_board='unix{-m32\ -march=native,-march=native}' get FAIL: gcc.target/i386/pr27827.c scan-assembler fmul[ \t]*%st FAIL: gcc.target/i386/pr50038.c scan-assembler-times movzbl 2 Since these 2 tests don't use SEE instructions originally, compile them with -mno-sse to avoid test failures. PR tree-optimization/126028 * gcc.target/i386/pr27827.c: Compile -mno-sse. * gcc.target/i386/pr50038.c: Likewise. Signed-off-by: H.J. Lu <[email protected]> --- gcc/testsuite/gcc.target/i386/pr27827.c | 2 +- gcc/testsuite/gcc.target/i386/pr50038.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/pr27827.c b/gcc/testsuite/gcc.target/i386/pr27827.c index 3b337444a40..fe678437f2c 100644 --- a/gcc/testsuite/gcc.target/i386/pr27827.c +++ b/gcc/testsuite/gcc.target/i386/pr27827.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -mfpmath=387" } */ +/* { dg-options "-O2 -mno-sse -mfpmath=387" } */ double a, b; double f(double c) diff --git a/gcc/testsuite/gcc.target/i386/pr50038.c b/gcc/testsuite/gcc.target/i386/pr50038.c index fb635dfcc9d..10e002c8db1 100644 --- a/gcc/testsuite/gcc.target/i386/pr50038.c +++ b/gcc/testsuite/gcc.target/i386/pr50038.c @@ -1,6 +1,6 @@ /* PR target/50038 */ /* { dg-do compile } */ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -mno-sse" } */ void test (int len, unsigned char *in, unsigned char *out) -- 2.55.0
