[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Add testcase for shifted truthvalue
Jeff Law
law@gcc.gnu.org
Thu Jan 29 19:45:42 GMT 2026
https://gcc.gnu.org/g:73b4d4c84eccf2f6c2c88f638b8d47b626474d77
commit 73b4d4c84eccf2f6c2c88f638b8d47b626474d77
Author: Philipp Tomsich <philipp.tomsich@vrull.eu>
Date: Sat Nov 8 09:28:07 2025 -0700
[RISC-V] Add testcase for shifted truthvalue
I was doing some cleanup on our internal tree and noticed a pattern that I
didn't think was actually useful in practice. Thankfully the internal commit
included a testcase clearly targeting that pattern.
I'm upstreaming the testcase, but not the unnecessary pattern.
gcc/testsuite
* gcc.target/riscv/snez.c: New test.
(cherry picked from commit 191896c993b1ba23dba0d0babbf8d1a043de2bd3)
Diff:
---
gcc/testsuite/gcc.target/riscv/snez.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/gcc/testsuite/gcc.target/riscv/snez.c b/gcc/testsuite/gcc.target/riscv/snez.c
new file mode 100644
index 000000000000..e5a7fad770a0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/snez.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc -mabi=lp64" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-O1" } } */
+
+int f (long long a)
+{
+ return (a != 2) << 1;
+}
+
+/* { dg-final { scan-assembler-times "slli\t" 1 } } */
+/* { dg-final { scan-assembler-not "srli\t" } } */
+/* { dg-final { scan-assembler-times "snez\t" 1 } } */
+/* { dg-final { scan-assembler-not "sext.w\t" } } */
+
More information about the Gcc-cvs
mailing list