aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>2023-06-26 16:11:55 +0800
committerPan Li <pan2.li@intel.com>2023-06-26 22:05:20 +0800
commitf0deeefebb661a1e6560e10bdb19c142792ef9c1 (patch)
tree9957f30055dbc41b2666828047682d862a338f74 /gcc/testsuite
parent4dfeb1cd8dfca234186216d891ec8f46235c3a14 (diff)
downloadgcc-f0deeefebb661a1e6560e10bdb19c142792ef9c1.zip
gcc-f0deeefebb661a1e6560e10bdb19c142792ef9c1.tar.gz
gcc-f0deeefebb661a1e6560e10bdb19c142792ef9c1.tar.bz2
GIMPLE_FOLD: Fix gimple fold for LEN_{MASK}_{LOAD,STORE}
Hi, previous I made a mistake on GIMPLE_FOLD of LEN_MASK_{LOAD,STORE}. We should fold LEN_MASK_{LOAD,STORE} (bias+len) == vf (nunits instead of bytesize) && mask = all trues mask into: MEM_REF [...]. This patch added testcase to test gimple fold of LEN_MASK_{LOAD,STORE}. Also, I fix LEN_LOAD/LEN_STORE, to make them have the same behavior. Ok for trunk ? gcc/ChangeLog: * gimple-fold.cc (gimple_fold_partial_load_store_mem_ref): Fix gimple fold of LOAD/STORE with length. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c
new file mode 100644
index 0000000..23407a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m8 -O3 -fdump-tree-optimized-details" } */
+
+#include <stdint-gcc.h>
+
+#define SZ 255
+
+#define DEF(TYPE) void fn_##TYPE (TYPE *__restrict a);
+
+#define RUN(TYPE) \
+ TYPE a##TYPE[SZ]; \
+ for (int i = 0; i < SZ; i++) \
+ { \
+ a##TYPE[i] = 127; \
+ } \
+ fn_##TYPE (a##TYPE);
+
+#define RUN_ALL() \
+ RUN (int8_t) \
+ RUN (int16_t) \
+ RUN (int32_t) \
+ RUN (int64_t) \
+ RUN (uint8_t) \
+ RUN (uint16_t) \
+ RUN (uint32_t) \
+ RUN (uint64_t)
+
+DEF (int8_t)
+DEF (int16_t)
+DEF (int32_t)
+DEF (int64_t)
+DEF (uint8_t)
+DEF (uint16_t)
+DEF (uint32_t)
+DEF (uint64_t)
+
+int
+main ()
+{
+ RUN_ALL ()
+}
+
+/* { dg-final { scan-tree-dump-times "\.LEN_MASK_STORE" 6 "optimized" } } */