aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorLehua Ding <lehua.ding@rivai.ai>2023-09-18 20:04:07 +0800
committerLehua Ding <lehua.ding@rivai.ai>2023-09-18 20:15:43 +0800
commit4ab744ace2478c4b986ec4ac27c0e3467b7a6419 (patch)
tree3f695c72905f0fd5f67fd4a1e4346702ba572c26 /gcc
parent71e0f38dcb73e4cdfe61fc28821551b325320302 (diff)
downloadgcc-4ab744ace2478c4b986ec4ac27c0e3467b7a6419.zip
gcc-4ab744ace2478c4b986ec4ac27c0e3467b7a6419.tar.gz
gcc-4ab744ace2478c4b986ec4ac27c0e3467b7a6419.tar.bz2
RISC-V: Add fixed PR111255 testcase by other patch
This patch add the missed PR111255 testcase which is fixed by this committed patch (https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628922.html). PR target/111255 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/pr111255.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111255.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111255.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111255.c
new file mode 100644
index 0000000..736f683
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111255.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 --param riscv-autovec-lmul=m2 -fno-vect-cost-model" } */
+
+#include <stdint.h>
+
+#define DEF_LOOP(OLD_TYPE, NEW_TYPE) \
+ void __attribute__ ((noipa)) \
+ test_##OLD_TYPE##_2_##NEW_TYPE (NEW_TYPE *__restrict r, \
+ OLD_TYPE *__restrict a, NEW_TYPE b, \
+ OLD_TYPE *__restrict pred, int n) \
+ { \
+ for (int i = 0; i < n; ++i) \
+ { \
+ r[i] = pred[i] ? (NEW_TYPE) a[i] : b; \
+ } \
+ }
+
+/* INT -> narrower-INT */
+#define TEST_ALL_X2X_NARROWER(T) \
+ T (int16_t, int8_t)
+
+TEST_ALL_X2X_NARROWER (DEF_LOOP)
+
+/* { dg-final { scan-assembler-not {\tvsetvli\t[a-x0-9]+,[a-x0-9]+,e[0-9]+,m[f0-9]+,t[au],m[au]\n\tvsetvli\t} } } */