diff options
author | Pan Li <pan2.li@intel.com> | 2024-10-23 16:52:01 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2024-10-29 22:19:46 +0800 |
commit | 072d6bb67a51ceb9d7056f479f15f4c9f3b50b20 (patch) | |
tree | d229c8c2023a07c113c9c61887741d7af0799d8e | |
parent | 30435cc261071d389d9a210f598170ecdd5ea13c (diff) | |
download | gcc-072d6bb67a51ceb9d7056f479f15f4c9f3b50b20.zip gcc-072d6bb67a51ceb9d7056f479f15f4c9f3b50b20.tar.gz gcc-072d6bb67a51ceb9d7056f479f15f4c9f3b50b20.tar.bz2 |
RISC-V: Add testcases for form 1 of MASK_LEN_STRIDED_LOAD{STORE}
Form 1:
void __attribute__((noinline)) \
vec_strided_load_store_##T##_form_1 (T *restrict out, T *restrict in, \
long stride, size_t size) \
{ \
for (size_t i = 0; i < size; i++) \
out[i * stride] = in[i * stride]; \
}
The below test suites are passed for this patch:
* The riscv fully regression test.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/rvv.exp: Add strided folder.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f16.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f32.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f64.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i16.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i32.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i64.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i8.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u16.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u32.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u64.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u8.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f16.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f32.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f64.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i16.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i32.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i64.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i8.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u16.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u32.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u64.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u8.c: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st.h: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st_data.h: New test.
* gcc.target/riscv/rvv/autovec/strided/strided_ld_st_run.h: New test.
Signed-off-by: Pan Li <pan2.li@intel.com>
Co-Authored-By: Juzhe-Zhong <juzhe.zhong@rivai.ai>
26 files changed, 1482 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f16.c new file mode 100644 index 0000000..41fe2b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f16.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(_Float16) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse16.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse16.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f32.c new file mode 100644 index 0000000..650b5fc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(float) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse32.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse32.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f64.c new file mode 100644 index 0000000..c0559a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-f64.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(double) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse64.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse64.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i16.c new file mode 100644 index 0000000..641eaf1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i16.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(int16_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse16.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse16.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i32.c new file mode 100644 index 0000000..5fc1ea9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(int32_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse32.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse32.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i64.c new file mode 100644 index 0000000..1819941 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i64.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(int64_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse64.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse64.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i8.c new file mode 100644 index 0000000..119a6d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-i8.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(int8_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse8.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse8.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u16.c new file mode 100644 index 0000000..19d4f6e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u16.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(uint16_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse16.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse16.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u32.c new file mode 100644 index 0000000..10b1d4f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(uint32_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse32.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse32.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u64.c new file mode 100644 index 0000000..b1654b8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u64.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(uint64_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse64.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse64.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u8.c new file mode 100644 index 0000000..273dcb8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-1-u8.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model -fdump-rtl-expand-details" } */ + +#include "strided_ld_st.h" + +DEF_STRIDED_LD_ST_FORM_1(uint8_t) + +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_LOAD " 4 "expand" } } */ +/* { dg-final { scan-rtl-dump-times ".MASK_LEN_STRIDED_STORE " 4 "expand" } } */ +/* { dg-final { scan-assembler-times {vlse8.v} 1 } } */ +/* { dg-final { scan-assembler-times {vsse8.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f16.c new file mode 100644 index 0000000..21dd7dc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f16.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T _Float16 + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f32.c new file mode 100644 index 0000000..da3932b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f32.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T float + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f64.c new file mode 100644 index 0000000..4e7ec6e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-f64.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T double + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i16.c new file mode 100644 index 0000000..6479106 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i16.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T int16_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i32.c new file mode 100644 index 0000000..223a894 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i32.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T int32_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i64.c new file mode 100644 index 0000000..1835b41 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i64.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T int64_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i8.c new file mode 100644 index 0000000..cee43db --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-i8.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T int8_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u16.c new file mode 100644 index 0000000..6fe2a57 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u16.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T uint16_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u32.c new file mode 100644 index 0000000..f2a7ece --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u32.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T uint32_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u64.c new file mode 100644 index 0000000..19490a3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u64.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T uint64_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u8.c new file mode 100644 index 0000000..e9c3b9e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st-run-1-u8.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { riscv_v } } } */ +/* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */ + +#include "strided_ld_st.h" +#include "strided_ld_st_data.h" + +#define T uint8_t + +DEF_STRIDED_LD_ST_FORM_1_WRAP(T) + +#define DATA TEST_STRIDED_LD_ST_DATA_WRAP(T) +#define RUN_STRIDED_LD_ST(out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) + +#include "strided_ld_st_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st.h new file mode 100644 index 0000000..8c86dec --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st.h @@ -0,0 +1,22 @@ +#ifndef HAVE_DEFINED_STRIDED_H +#define HAVE_DEFINED_STRIDED_H + +#include <stdint-gcc.h> +#include <stdbool.h> +#include <stddef.h> + +#define DEF_STRIDED_LD_ST_FORM_1(T) \ + void __attribute__((noinline)) \ + vec_strided_load_store_##T##_form_1 (T *restrict out, T *restrict in, \ + long stride, size_t size) \ + { \ + for (size_t i = 0; i < size; i++) \ + out[i * stride] = in[i * stride]; \ + } +#define DEF_STRIDED_LD_ST_FORM_1_WRAP(T) DEF_STRIDED_LD_ST_FORM_1(T) +#define RUN_STRIDED_LD_ST_FORM_1(T, out, in, stride, size) \ + vec_strided_load_store_##T##_form_1 (out, in, stride, size) +#define RUN_STRIDED_LD_ST_FORM_1_WRAP(T, out, in, stride, size) \ + RUN_STRIDED_LD_ST_FORM_1(T, out, in, stride, size) + +#endif diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st_data.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st_data.h new file mode 100644 index 0000000..ebf8197 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st_data.h @@ -0,0 +1,1145 @@ +#ifndef HAVE_DEFINED_STRIDED_DATA_H +#define HAVE_DEFINED_STRIDED_DATA_H + +#include <stdint-gcc.h> +#include <stdbool.h> +#include <stddef.h> + +#define N 32 +#define TEST_STRIDED_LD_ST_DATA(T) test_strided_ld_st_##T##_data +#define TEST_STRIDED_LD_ST_DATA_WRAP(T) TEST_STRIDED_LD_ST_DATA(T) + +int8_t TEST_STRIDED_LD_ST_DATA(int8_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 127, 127, 127, 127, + 127, 127, 127, 127, + 127, 127, 127, 127, + 127, 127, 127, 127, + -128, -128, -128, -128, + -128, -128, -128, -128, + -128, -128, -128, -128, + -128, -128, -128, -128, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 127, 0, 0, 0, + 127, 0, 0, 0, + 127, 0, 0, 0, + 127, 0, 0, 0, + -128, 0, 0, 0, + -128, 0, 0, 0, + -128, 0, 0, 0, + -128, 0, 0, 0, + }, + }, +}; + +int16_t TEST_STRIDED_LD_ST_DATA(int16_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, + 32767, 32767, 32767, 32767, + -32768, -32768, -32768, -32768, + -32768, -32768, -32768, -32768, + -32768, -32768, -32768, -32768, + -32768, -32768, -32768, -32768, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 32767, 0, 0, 0, + 32767, 0, 0, 0, + 32767, 0, 0, 0, + 32767, 0, 0, 0, + -32768, 0, 0, 0, + -32768, 0, 0, 0, + -32768, 0, 0, 0, + -32768, 0, 0, 0, + }, + }, +}; + +int32_t TEST_STRIDED_LD_ST_DATA(int32_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 2147483647, 2147483647, 2147483647, 2147483647, + 2147483647, 2147483647, 2147483647, 2147483647, + 2147483647, 2147483647, 2147483647, 2147483647, + 2147483647, 2147483647, 2147483647, 2147483647, + -2147483648, -2147483648, -2147483648, -2147483648, + -2147483648, -2147483648, -2147483648, -2147483648, + -2147483648, -2147483648, -2147483648, -2147483648, + -2147483648, -2147483648, -2147483648, -2147483648, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2147483647, 0, 0, 0, + 2147483647, 0, 0, 0, + 2147483647, 0, 0, 0, + 2147483647, 0, 0, 0, + -2147483648, 0, 0, 0, + -2147483648, 0, 0, 0, + -2147483648, 0, 0, 0, + -2147483648, 0, 0, 0, + }, + }, +}; + +int64_t TEST_STRIDED_LD_ST_DATA(int64_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, 9223372036854775807ll, + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, -9223372036854775808ull, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 9223372036854775807ll, 0, 0, 0, + 9223372036854775807ll, 0, 0, 0, + 9223372036854775807ll, 0, 0, 0, + 9223372036854775807ll, 0, 0, 0, + -9223372036854775808ull, 0, 0, 0, + -9223372036854775808ull, 0, 0, 0, + -9223372036854775808ull, 0, 0, 0, + -9223372036854775808ull, 0, 0, 0, + }, + }, +}; + +uint8_t TEST_STRIDED_LD_ST_DATA(uint8_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 254, 254, 254, 254, + 254, 254, 254, 254, + 254, 254, 254, 254, + 254, 254, 254, 254, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 255, 0, 0, 0, + 255, 0, 0, 0, + 255, 0, 0, 0, + 255, 0, 0, 0, + 254, 0, 0, 0, + 254, 0, 0, 0, + 254, 0, 0, 0, + 254, 0, 0, 0, + }, + }, +}; + +uint16_t TEST_STRIDED_LD_ST_DATA(uint16_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 65535, 65535, 65535, 65535, + 65535, 65535, 65535, 65535, + 65535, 65535, 65535, 65535, + 65535, 65535, 65535, 65535, + 65534, 65534, 65534, 65534, + 65534, 65534, 65534, 65534, + 65534, 65534, 65534, 65534, + 65534, 65534, 65534, 65534, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 65535, 0, 0, 0, + 65535, 0, 0, 0, + 65535, 0, 0, 0, + 65535, 0, 0, 0, + 65534, 0, 0, 0, + 65534, 0, 0, 0, + 65534, 0, 0, 0, + 65534, 0, 0, 0, + }, + }, +}; + +uint32_t TEST_STRIDED_LD_ST_DATA(uint32_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 4294967295, 4294967295, 4294967295, 4294967295, + 4294967295, 4294967295, 4294967295, 4294967295, + 4294967295, 4294967295, 4294967295, 4294967295, + 4294967295, 4294967295, 4294967295, 4294967295, + 4294967294, 4294967294, 4294967294, 4294967294, + 4294967294, 4294967294, 4294967294, 4294967294, + 4294967294, 4294967294, 4294967294, 4294967294, + 4294967294, 4294967294, 4294967294, 4294967294, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 4294967295, 0, 0, 0, + 4294967295, 0, 0, 0, + 4294967295, 0, 0, 0, + 4294967295, 0, 0, 0, + 4294967294, 0, 0, 0, + 4294967294, 0, 0, 0, + 4294967294, 0, 0, 0, + 4294967294, 0, 0, 0, + }, + }, +}; + +uint64_t TEST_STRIDED_LD_ST_DATA(uint64_t)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + 2, 3, 9, 7, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + 2, 0, 9, 0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, + 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, + 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, + 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, + 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, + 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, + 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, + 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 18446744073709551615ull, 0, 0, 0, + 18446744073709551615ull, 0, 0, 0, + 18446744073709551615ull, 0, 0, 0, + 18446744073709551615ull, 0, 0, 0, + 18446744073709551614ull, 0, 0, 0, + 18446744073709551614ull, 0, 0, 0, + 18446744073709551614ull, 0, 0, 0, + 18446744073709551614ull, 0, 0, 0, + }, + }, +}; + +_Float16 TEST_STRIDED_LD_ST_DATA(_Float16)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + }, + { /* output */ + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + }, + { /* expect */ + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + }, + { /* output */ + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + }, + { /* expect */ + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 127.8, 127.8, 127.8, 127.8, + 127.8, 127.8, 127.8, 127.8, + 127.8, 127.8, 127.8, 127.8, + 127.8, 127.8, 127.8, 127.8, + -128.2, -128.2, -128.2, -128.2, + -128.2, -128.2, -128.2, -128.2, + -128.2, -128.2, -128.2, -128.2, + -128.2, -128.2, -128.2, -128.2, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 127.8, 0, 0, 0, + 127.8, 0, 0, 0, + 127.8, 0, 0, 0, + 127.8, 0, 0, 0, + -128.2, 0, 0, 0, + -128.2, 0, 0, 0, + -128.2, 0, 0, 0, + -128.2, 0, 0, 0, + }, + }, +}; + +float TEST_STRIDED_LD_ST_DATA(float)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + }, + { /* output */ + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + }, + { /* expect */ + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + }, + { /* output */ + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + }, + { /* expect */ + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, + 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, + 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, + 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, 148885872271752691712.0, + -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, + -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, + -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, + -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, -639460027801474761417333669888.0, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 148885872271752691712.0, 0, 0, 0, + 148885872271752691712.0, 0, 0, 0, + 148885872271752691712.0, 0, 0, 0, + 148885872271752691712.0, 0, 0, 0, + -639460027801474761417333669888.0, 0, 0, 0, + -639460027801474761417333669888.0, 0, 0, 0, + -639460027801474761417333669888.0, 0, 0, 0, + -639460027801474761417333669888.0, 0, 0, 0, + }, + }, +}; + +double TEST_STRIDED_LD_ST_DATA(double)[][4][N] = +{ + { + { 1 }, /* stride */ + { /* input */ + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + }, + { /* output */ + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + }, + { /* expect */ + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + 1.4, 0.2, 0.8, 0.8, + 0.4, 1.2, 0.8, 0.8, + 0.4, 0.2, 1.8, 0.8, + 0.4, 0.2, 0.8, 1.8, + }, + }, + { + { 2 }, /* stride */ + { /* input */ + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + 2.6, 3.1, 9.4, 7.8, + }, + { /* output */ + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + }, + { /* expect */ + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + 2.6, 0.0, 9.4, 0.0, + }, + }, + { + { 4 }, /* stride */ + { /* input */ + 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, + 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, + 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, + 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, 98789784453484056064183762944.0, + -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, + -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, + -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, + -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, -1507412482505555054690304.0, + }, + { /* output */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + }, + { /* expect */ + 98789784453484056064183762944.0, 0, 0, 0, + 98789784453484056064183762944.0, 0, 0, 0, + 98789784453484056064183762944.0, 0, 0, 0, + 98789784453484056064183762944.0, 0, 0, 0, + -1507412482505555054690304.0, 0, 0, 0, + -1507412482505555054690304.0, 0, 0, 0, + -1507412482505555054690304.0, 0, 0, 0, + -1507412482505555054690304.0, 0, 0, 0, + }, + }, +}; + +#endif diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st_run.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st_run.h new file mode 100644 index 0000000..2549dad --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/strided/strided_ld_st_run.h @@ -0,0 +1,27 @@ +#ifndef HAVE_DEFINE_STRIDED_LD_ST_H +#define HAVE_DEFINE_STRIDED_LD_ST_H + +int +main () +{ + unsigned i, k; + + for (i = 0; i < sizeof (DATA) / sizeof (DATA[0]); i++) + { + T stride = DATA[i][0][0]; + T *in = DATA[i][1]; + T *out = DATA[i][2]; + T *expect = DATA[i][3]; + + RUN_STRIDED_LD_ST (out, in, stride, N / stride); + + for (k = 0; k < N; k = k + stride) + if (out[k] != expect[k]) + __builtin_abort (); + } + + return 0; +} + +#endif + diff --git a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp index 8c4e916..12002dd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp +++ b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp @@ -120,6 +120,8 @@ set AUTOVEC_TEST_OPTS [list \ foreach op $AUTOVEC_TEST_OPTS { dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/gather-scatter/*.\[cS\]]] \ "" "$op" + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/strided/*.\[cS\]]] \ + "" "$op" } # All done. |