This patch contains the testcase in PR120378 after the change made to
support the vnclipu variant of the SAT_TRUNC pattern.
PR target/120378
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr120378.c: New test.
Signed-off-by: Edwin Lu <[email protected]>
---
.../gcc.target/riscv/rvv/autovec/pr120378.c | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr120378.c
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr120378.c
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr120378.c
new file mode 100644
index 00000000000..500028e7a15
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr120378.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
+
+#include <stdint.h>
+
+inline uint8_t
+clip_uint8 (int x)
+{
+ return x & (~255) ? (-x) >> 31 : x;
+}
+
+void __attribute__ ((noipa))
+clip_loop (uint8_t *res, int *x, int w)
+{
+ for (int i = 0; i < w; i++)
+ res[i] = clip_uint8 (x[i]);
+}
+
+/* { dg-final { scan-tree-dump-times ".SAT_TRUNC " 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR " 1 "optimized" } } */
+/* { dg-final { scan-assembler-times {vnclipu\.wi} 2 } } */
--
2.43.0