summaryrefslogtreecommitdiff
path: root/gcc/config/riscv/vector.md
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/riscv/vector.md')
-rw-r--r--gcc/config/riscv/vector.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index 8683212bba6..e8bb7c5dec1 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -407,6 +407,26 @@
(symbol_ref "INTVAL (operands[4])")]
(const_int INVALID_ATTRIBUTE)))
+;; Defines rounding mode of an fixed-point operation.
+
+(define_attr "vxrm_mode" "rnu,rne,rdn,rod,none"
+ (cond [(and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip")
+ (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_RNU"))
+ (const_string "rnu")
+
+ (and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip")
+ (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_RNE"))
+ (const_string "rne")
+
+ (and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip")
+ (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_RDN"))
+ (const_string "rdn")
+
+ (and (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip")
+ (match_test "INTVAL(operands[9]) == riscv_vector::VXRM_ROD"))
+ (const_string "rod")]
+ (const_string "none")))
+
;; -----------------------------------------------------------------
;; ---- Miscellaneous Operations
;; -----------------------------------------------------------------
@@ -594,6 +614,15 @@
"TARGET_VECTOR"
"")
+;; Set VXRM
+(define_insn "vxrmsi"
+ [(set (reg:SI VXRM_REGNUM)
+ (match_operand 0 "const_int_operand" "i"))]
+ "TARGET_VECTOR"
+ "csrwi\tvxrm,%0"
+ [(set_attr "type" "wrvxrm")
+ (set_attr "mode" "SI")])
+
;; -----------------------------------------------------------------
;; ---- Moves Operations
;; -----------------------------------------------------------------