aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/riscv/autovec.md
diff options
context:
space:
mode:
authorRobin Dapp <rdapp@ventanamicro.com>2023-10-24 10:33:15 +0200
committerRobin Dapp <rdapp@ventanamicro.com>2023-10-27 16:26:36 +0200
commit9c032218107675291d05be28f8c08a32e3a17b95 (patch)
tree744af97ad5c284a9789105aaa0f31dc2ec3ef53d /gcc/config/riscv/autovec.md
parent3351ec2a9803cf4f0f43ef70b6925a039850d6ca (diff)
downloadgcc-9c032218107675291d05be28f8c08a32e3a17b95.zip
gcc-9c032218107675291d05be28f8c08a32e3a17b95.tar.gz
gcc-9c032218107675291d05be28f8c08a32e3a17b95.tar.bz2
RISC-V: Add rawmemchr expander.
This patch adds a vectorized rawmemchr expander. It also moves the vectorized expand_block_move to riscv-string.cc. gcc/ChangeLog: * config/riscv/autovec.md (rawmemchr<ANYI:mode>): New expander. * config/riscv/riscv-protos.h (gen_no_side_effects_vsetvl_rtx): Define. (expand_rawmemchr): Define. * config/riscv/riscv-v.cc (force_vector_length_operand): Remove static. (expand_block_move): Move from here... * config/riscv/riscv-string.cc (expand_block_move): ...to here. (expand_rawmemchr): Add vectorized expander. * internal-fn.cc (expand_RAWMEMCHR): Fix typo. gcc/testsuite/ChangeLog: * gcc.dg/tree-prof/peel-2.c: Add -fno-tree-loop-distribute-patterns. * gcc.dg/tree-ssa/ldist-rawmemchr-1.c: Add riscv. * gcc.dg/tree-ssa/ldist-rawmemchr-2.c: Ditto. * gcc.target/riscv/rvv/rvv.exp: Add builtin directory. * gcc.target/riscv/rvv/autovec/builtin/rawmemchr-1.c: New test.
Diffstat (limited to 'gcc/config/riscv/autovec.md')
-rw-r--r--gcc/config/riscv/autovec.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index 80910ba..5f49d73 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -2367,3 +2367,16 @@
DONE;
}
)
+
+;; Implement rawmemchr[qi|si|hi].
+(define_expand "rawmemchr<ANYI:mode>"
+ [(match_operand 0 "register_operand")
+ (match_operand 1 "memory_operand")
+ (match_operand:ANYI 2 "const_int_operand")]
+ "TARGET_VECTOR"
+ {
+ riscv_vector::expand_rawmemchr(<MODE>mode, operands[0], operands[1],
+ operands[2]);
+ DONE;
+ }
+)