public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2212] RISC-V: Refactor vxrm_mode attr for type attr equal
@ 2023-06-30 11:14 Pan Li
  0 siblings, 0 replies; only message in thread
From: Pan Li @ 2023-06-30 11:14 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1cde8e5d45d74cf7ba85772b99b41a7c81769ff4

commit r14-2212-g1cde8e5d45d74cf7ba85772b99b41a7c81769ff4
Author: Pan Li <pan2.li@intel.com>
Date:   Fri Jun 30 19:12:22 2023 +0800

    RISC-V: Refactor vxrm_mode attr for type attr equal
    
    This patch would like to refactor the vxrm_mode attr for duplicated
    eq_attr condition. The common condition of attr is extraced to one
    place instead of many places.
    
    Signed-off-by: Pan Li <pan2.li@intel.com>
    
    gcc/ChangeLog:
    
            * config/riscv/vector.md: Refactor the common condition.

Diff:
---
 gcc/config/riscv/vector.md | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md
index 5e489dc91ba..a6174f9483e 100644
--- a/gcc/config/riscv/vector.md
+++ b/gcc/config/riscv/vector.md
@@ -445,22 +445,29 @@
 ;; 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")))
+  (cond
+    [
+      (eq_attr "type" "vsalu,vaalu,vsmul,vsshift,vnclip")
+      (cond
+	[
+	  (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RNU")
+	  (const_string "rnu")
+
+	  (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RNE")
+	  (const_string "rne")
+
+	  (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RDN")
+	  (const_string "rdn")
+
+	  (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_ROD")
+	  (const_string "rod")
+	]
+	(const_string "none")
+      )
+    ]
+    (const_string "none")
+  )
+)
 
 ;; Defines rounding mode of an floating-point operation.
 (define_attr "frm_mode" "rne,rtz,rdn,rup,rmm,dyn,none"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-30 11:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 11:14 [gcc r14-2212] RISC-V: Refactor vxrm_mode attr for type attr equal Pan Li

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).