On 7/6/2026 12:42 AM, Jim Lin wrote:
At -Og the a << 1 is kept as a separate slliw instead of being folded
into the zero_extendsidi2_shifted sequence, so the "slli" regex matches
both slliw and slli and the scan-assembler-times "slli" 1 check fails.
Skip the test under -Og.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/shift-shift-7.c: Skip under -Og.
I suspect that -Og/-Oz are not showing up in the flags as often as they
should. For reference here's a grep from a recent run:
grep shift-shift-7 gcc.sum
UNSUPPORTED: gcc.target/riscv/shift-shift-7.c -O0
PASS: gcc.target/riscv/shift-shift-7.c -O1 scan-assembler-times slli 1
PASS: gcc.target/riscv/shift-shift-7.c -O1 scan-assembler-times srli 1
PASS: gcc.target/riscv/shift-shift-7.c -O1 (test for excess errors)
PASS: gcc.target/riscv/shift-shift-7.c -O2 scan-assembler-times slli 1
PASS: gcc.target/riscv/shift-shift-7.c -O2 scan-assembler-times srli 1
PASS: gcc.target/riscv/shift-shift-7.c -O2 (test for excess errors)
PASS: gcc.target/riscv/shift-shift-7.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none scan-assembler-times slli 1
PASS: gcc.target/riscv/shift-shift-7.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none scan-assembler-times srli 1
PASS: gcc.target/riscv/shift-shift-7.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none (test for excess errors)
PASS: gcc.target/riscv/shift-shift-7.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects scan-assembler-times slli 1
PASS: gcc.target/riscv/shift-shift-7.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects scan-assembler-times srli 1
PASS: gcc.target/riscv/shift-shift-7.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects (test for excess errors)
PASS: gcc.target/riscv/shift-shift-7.c -O3 -g scan-assembler-times
slli 1
PASS: gcc.target/riscv/shift-shift-7.c -O3 -g scan-assembler-times
srli 1
PASS: gcc.target/riscv/shift-shift-7.c -O3 -g (test for excess errors)
PASS: gcc.target/riscv/shift-shift-7.c -Os scan-assembler-times slli 1
PASS: gcc.target/riscv/shift-shift-7.c -Os scan-assembler-times srli 1
PASS: gcc.target/riscv/shift-shift-7.c -Os (test for excess errors)
No -Og/-Oz. If you're getting testing with -Og/-Oz, then I wouldn't be
at all surprised to find there's other files that will need to skip with
those options.
Anyway, I've pushed this to the trunk.
Thanks again,
Jeff