https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127166

            Bug ID: 127166
           Summary: [17 Regression] Recent saturation/clipping match.pd
                    changes regressing on RISC-V
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at gcc dot gnu.org
  Target Milestone: ---

I *think* this stuff was working in gcc-16, so this represents a regression
with gcc-17.

This change:

commit 3c5cc8819fe03b63cba9ff82569623d092fdf0f5 (HEAD)
Author: Kyrylo Tkachov <[email protected]>
Date:   Wed Aug 19 11:54:14 2026 +0200

    Match: Reject NARROW_CLIP saturating truncation at the minimum [PR126981]
[ ... ]

Is causing several failures on RISC-V:

Tests that now fail, but worked before (6 tests):

unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/pr120378-1.c -O3 -ftree-vectorize 
scan-assembler-times vnclipu\\.wi 2
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/pr120378-1.c -O3 -ftree-vectorize 
scan-tree-dump-times optimized ".SAT_TRUNC " 1
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/pr120378-1.c -O3 -ftree-vectorize 
scan-tree-dump-times optimized "MAX_EXPR " 1
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/pr120378-2.c -O3 -ftree-vectorize 
scan-assembler-times vnclipu\\.wi 1
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/pr120378-3.c -O3 -ftree-vectorize 
scan-assembler-times vnclipu\\.wi 3
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/pr120378-4.c -O3 -ftree-vectorize 
scan-assembler-times vnclipu\\.wi 2

Just perusing the generated code for pr120378-1, the old code looks
considerably better.

I haven't done any debugging on this other than bisection.

Reply via email to