[gcc r17-2963] RISC-V: Add test cases for vwsub.vv reg overlap
Pan Li via Gcc-cvs <[email protected]> Wed, 5 Aug 2026 01:12:20 +0000 (GMT)
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:44e0270ff4824f00aa290f6ac5aed14ed1d7436e commit r17-2963-g44e0270ff4824f00aa290f6ac5aed14ed1d7436e Author: Pan Li <[email protected]> Date: Sat Aug 1 21:04:06 2026 +0800 RISC-V: Add test cases for vwsub.vv reg overlap Add test cases for register group overlap, please note it is not overlap as much as possible. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m1.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m2.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m4.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf2.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf4.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m1.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m2.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m4.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-mf2.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m1.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m2.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m4.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf2.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf4.c: New test. * gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf8.c: New test. Signed-off-by: Pan Li <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Diff: --- .../riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m1.c | 17 +++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m2.c | 17 +++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m4.c | 17 +++++++++++++++++ .../rvv/autovec/group_overlap/vwsub_vv-i16-mf2.c | 19 +++++++++++++++++++ .../rvv/autovec/group_overlap/vwsub_vv-i16-mf4.c | 19 +++++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m1.c | 17 +++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m2.c | 17 +++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m4.c | 17 +++++++++++++++++ .../rvv/autovec/group_overlap/vwsub_vv-i32-mf2.c | 19 +++++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m1.c | 17 +++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m2.c | 17 +++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m4.c | 17 +++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf2.c | 19 +++++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf4.c | 19 +++++++++++++++++++ .../riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf8.c | 19 +++++++++++++++++++ 15 files changed, 267 insertions(+) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m1.c new file mode 100644 index 000000000000..cdfea40e8795 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e16m1, + vint16m1_t, + vint32m2_t, + __riscv_vle16_v_i16m1, + __riscv_vwsub_vv_i32m2, + __riscv_vse32_v_i32m2, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v2,v1,v3([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v10,v11,v3([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m2.c new file mode 100644 index 000000000000..231db3ff8c1d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e16m2, + vint16m2_t, + vint32m4_t, + __riscv_vle16_v_i16m2, + __riscv_vwsub_vv_i32m4, + __riscv_vse32_v_i32m4, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X8) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v8,v10,v6([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v28,v30,v24([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m4.c new file mode 100644 index 000000000000..1a82544270e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-m4.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e16m4, + vint16m4_t, + vint32m8_t, + __riscv_vle16_v_i16m4, + __riscv_vwsub_vv_i32m8, + __riscv_vse32_v_i32m8, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X4) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v8,v4,v12([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v24,v28,v16([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf2.c new file mode 100644 index 000000000000..29c759aa0259 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e16m1, + vint16mf2_t, + vint32m1_t, + __riscv_vle16_v_i16mf2, + __riscv_vwsub_vv_i32m1, + __riscv_vse32_v_i32m1, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* The fractional LMUL source has EMUL < 1, thus the widened destination + register group must not overlap either source at all. */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),\1,} } } */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),v[0-9]+,\1([^0-9]|$)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf4.c new file mode 100644 index 000000000000..771548682a57 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i16-mf4.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e16m1, + vint16mf4_t, + vint32mf2_t, + __riscv_vle16_v_i16mf4, + __riscv_vwsub_vv_i32mf2, + __riscv_vse32_v_i32mf2, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* The fractional LMUL source has EMUL < 1, thus the widened destination + register group must not overlap either source at all. */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),\1,} } } */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),v[0-9]+,\1([^0-9]|$)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m1.c new file mode 100644 index 000000000000..b0b0ba4c43a2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e32m1, + vint32m1_t, + vint64m2_t, + __riscv_vle32_v_i32m1, + __riscv_vwsub_vv_i64m2, + __riscv_vse64_v_i64m2, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v2,v1,v3([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v10,v11,v3([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m2.c new file mode 100644 index 000000000000..4182d6e05dda --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e32m2, + vint32m2_t, + vint64m4_t, + __riscv_vle32_v_i32m2, + __riscv_vwsub_vv_i64m4, + __riscv_vse64_v_i64m4, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X8) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v8,v10,v6([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v28,v30,v24([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m4.c new file mode 100644 index 000000000000..ab13a1b495c2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-m4.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e32m4, + vint32m4_t, + vint64m8_t, + __riscv_vle32_v_i32m4, + __riscv_vwsub_vv_i64m8, + __riscv_vse64_v_i64m8, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X4) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v8,v4,v12([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v24,v28,v16([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-mf2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-mf2.c new file mode 100644 index 000000000000..e3549fb347b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i32-mf2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e32m1, + vint32mf2_t, + vint64m1_t, + __riscv_vle32_v_i32mf2, + __riscv_vwsub_vv_i64m1, + __riscv_vse64_v_i64m1, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* The fractional LMUL source has EMUL < 1, thus the widened destination + register group must not overlap either source at all. */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),\1,} } } */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),v[0-9]+,\1([^0-9]|$)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m1.c new file mode 100644 index 000000000000..d78c073e82c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e8m1, + vint8m1_t, + vint16m2_t, + __riscv_vle8_v_i8m1, + __riscv_vwsub_vv_i16m2, + __riscv_vse16_v_i16m2, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v2,v1,v3([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v10,v11,v3([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m2.c new file mode 100644 index 000000000000..1fb870a98205 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e8m2, + vint8m2_t, + vint16m4_t, + __riscv_vle8_v_i8m2, + __riscv_vwsub_vv_i16m4, + __riscv_vse16_v_i16m4, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X8) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v8,v10,v6([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v28,v30,v24([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m4.c new file mode 100644 index 000000000000..bed854c6f081 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-m4.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e8m4, + vint8m4_t, + vint16m8_t, + __riscv_vle8_v_i8m4, + __riscv_vwsub_vv_i16m8, + __riscv_vse16_v_i16m8, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X4) + +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v8,v4,v12([^0-9]|$)} 1 } } */ +/* { dg-final { scan-assembler-times {vwsub\.vv\s+v24,v28,v16([^0-9]|$)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf2.c new file mode 100644 index 000000000000..71c1328a948f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e8m1, + vint8mf2_t, + vint16m1_t, + __riscv_vle8_v_i8mf2, + __riscv_vwsub_vv_i16m1, + __riscv_vse16_v_i16m1, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* The fractional LMUL source has EMUL < 1, thus the widened destination + register group must not overlap either source at all. */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),\1,} } } */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),v[0-9]+,\1([^0-9]|$)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf4.c new file mode 100644 index 000000000000..1f52f2ebbc45 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf4.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e8m1, + vint8mf4_t, + vint16mf2_t, + __riscv_vle8_v_i8mf4, + __riscv_vwsub_vv_i16mf2, + __riscv_vse16_v_i16mf2, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* The fractional LMUL source has EMUL < 1, thus the widened destination + register group must not overlap either source at all. */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),\1,} } } */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),v[0-9]+,\1([^0-9]|$)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf8.c new file mode 100644 index 000000000000..cabe5647c1bd --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/group_overlap/vwsub_vv-i8-mf8.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "group_overlap.h" + +DEF_GROUP_OVERLAP_BINARY_1( + __riscv_vsetvlmax_e8m1, + vint8mf8_t, + vint16mf4_t, + __riscv_vle8_v_i8mf8, + __riscv_vwsub_vv_i16mf4, + __riscv_vse16_v_i16mf4, + vwsub_vv, + LOOP_DUAL_WIDEN_BINARY_BODY_X16) + +/* The fractional LMUL source has EMUL < 1, thus the widened destination + register group must not overlap either source at all. */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),\1,} } } */ +/* { dg-final { scan-assembler-not {vwsub\.vv\s+(v[0-9]+),v[0-9]+,\1([^0-9]|$)} } } */