[v1,7/8] RISC-V: bitmanip: add orc.b as an unspec
Commit Message
As a basis for optimized string functions (e.g., the by-pieces
implementations), we need orc.b available. This adds orc.b as an
unspec, so we can expand to it.
gcc/ChangeLog:
* config/riscv/bitmanip.md (orcb<mode>2): Add orc.b as an unspec.
* config/riscv/riscv.md: Add UNSPEC_ORC_B.
Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
---
gcc/config/riscv/bitmanip.md | 8 ++++++++
gcc/config/riscv/riscv.md | 3 +++
2 files changed, 11 insertions(+)
@@ -267,6 +267,14 @@ (define_insn "<bitmanip_optab><mode>3"
"<bitmanip_insn>\t%0,%1,%2"
[(set_attr "type" "bitmanip")])
+;; orc.b (or-combine) is added as an unspec for the benefit of the support
+;; for optimized string functions (such as strcmp).
+(define_insn "orcb<mode>2"
+ [(set (match_operand:X 0 "register_operand" "=r")
+ (unspec:X [(match_operand:X 1 "register_operand")] UNSPEC_ORC_B))]
+ "TARGET_ZBB"
+ "orc.b\t%0,%1")
+
;; ZBS extension.
(define_insn "*bset<mode>"
@@ -45,6 +45,9 @@ (define_c_enum "unspec" [
;; Stack tie
UNSPEC_TIE
+
+ ;; Zbb OR-combine instruction
+ UNSPEC_ORC_B
])
(define_c_enum "unspecv" [