* [Committed] RISC-V: Add VLS integer ABS support
@ 2023-09-21 22:47 Juzhe-Zhong
0 siblings, 0 replies; only message in thread
From: Juzhe-Zhong @ 2023-09-21 22:47 UTC (permalink / raw)
To: gcc-patches; +Cc: Juzhe-Zhong
Regression passed.
Committed.
gcc/ChangeLog:
* config/riscv/autovec.md: Extend VLS modes.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vls/abs-2.c: New test.
---
gcc/config/riscv/autovec.md | 6 +-
.../gcc.target/riscv/rvv/autovec/vls/abs-2.c | 62 +++++++++++++++++++
2 files changed, 65 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c
diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index f0f1abc4e82..c895d41376d 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -1004,9 +1004,9 @@
;; -------------------------------------------------------------------------------
(define_insn_and_split "abs<mode>2"
- [(set (match_operand:VI 0 "register_operand")
- (abs:VI
- (match_operand:VI 1 "register_operand")))]
+ [(set (match_operand:V_VLSI 0 "register_operand")
+ (abs:V_VLSI
+ (match_operand:V_VLSI 1 "register_operand")))]
"TARGET_VECTOR && can_create_pseudo_p ()"
"#"
"&& 1"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c
new file mode 100644
index 00000000000..e98f5c4bbf8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c
@@ -0,0 +1,62 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_OP_V (neg, 4, int8_t, __builtin_abs)
+DEF_OP_V (neg, 8, int8_t, __builtin_abs)
+DEF_OP_V (neg, 16, int8_t, __builtin_abs)
+DEF_OP_V (neg, 32, int8_t, __builtin_abs)
+DEF_OP_V (neg, 64, int8_t, __builtin_abs)
+DEF_OP_V (neg, 128, int8_t, __builtin_abs)
+DEF_OP_V (neg, 256, int8_t, __builtin_abs)
+DEF_OP_V (neg, 512, int8_t, __builtin_abs)
+DEF_OP_V (neg, 1024, int8_t, __builtin_abs)
+DEF_OP_V (neg, 2048, int8_t, __builtin_abs)
+DEF_OP_V (neg, 4096, int8_t, __builtin_abs)
+
+DEF_OP_V (neg, 4, int16_t, __builtin_abs)
+DEF_OP_V (neg, 8, int16_t, __builtin_abs)
+DEF_OP_V (neg, 16, int16_t, __builtin_abs)
+DEF_OP_V (neg, 32, int16_t, __builtin_abs)
+DEF_OP_V (neg, 64, int16_t, __builtin_abs)
+DEF_OP_V (neg, 128, int16_t, __builtin_abs)
+DEF_OP_V (neg, 256, int16_t, __builtin_abs)
+DEF_OP_V (neg, 512, int16_t, __builtin_abs)
+DEF_OP_V (neg, 1024, int16_t, __builtin_abs)
+DEF_OP_V (neg, 2048, int16_t, __builtin_abs)
+
+DEF_OP_V (neg, 4, int32_t, __builtin_abs)
+DEF_OP_V (neg, 8, int32_t, __builtin_abs)
+DEF_OP_V (neg, 16, int32_t, __builtin_abs)
+DEF_OP_V (neg, 32, int32_t, __builtin_abs)
+DEF_OP_V (neg, 64, int32_t, __builtin_abs)
+DEF_OP_V (neg, 128, int32_t, __builtin_abs)
+DEF_OP_V (neg, 256, int32_t, __builtin_abs)
+DEF_OP_V (neg, 512, int32_t, __builtin_abs)
+DEF_OP_V (neg, 1024, int32_t, __builtin_abs)
+
+DEF_OP_V (neg, 4, int64_t, __builtin_abs)
+DEF_OP_V (neg, 8, int64_t, __builtin_abs)
+DEF_OP_V (neg, 16, int64_t, __builtin_abs)
+DEF_OP_V (neg, 32, int64_t, __builtin_abs)
+DEF_OP_V (neg, 64, int64_t, __builtin_abs)
+DEF_OP_V (neg, 128, int64_t, __builtin_abs)
+DEF_OP_V (neg, 256, int64_t, __builtin_abs)
+DEF_OP_V (neg, 512, int64_t, __builtin_abs)
+
+/* { dg-final { scan-assembler-times {vneg\.v} 38 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vi} 38 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--
2.36.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-21 22:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21 22:47 [Committed] RISC-V: Add VLS integer ABS support Juzhe-Zhong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).