diff mbox series

[09/31] VAX: Use a mode iterator to produce individual interlocked branches

Message ID alpine.LFD.2.21.2011200246240.656242@eddie.linux-mips.org
State Accepted
Headers show
Series VAX: Bring the port up to date (yes, MODE_CC conversion is included) | expand

Commit Message

Maciej W. Rozycki Nov. 20, 2020, 3:34 a.m. UTC
Regardless of the machine mode all the interlocked branches of the same
kind, one of the two provided by the ISA, use the same RTL patterns and
machine instructions, except for the memory operand's constraint.

Remove code duplication then and make use of a mode iterator combined
with an attribute to expand the same insn patterns with the constraint
suitably substituted from a single template.  No functional change.

	gcc/
	* config/vax/builtins.md (bb_mem): New mode attribute.
	(jbbssiqi, jbbssihi, jbbssisi): Fold insns into...
	(jbbssi<mode>): ... this.
	(jbbcciqi, jbbccihi, jbbccisi): Likewise...
	(jbbcci<mode>): ... this.
---
 gcc/config/vax/builtins.md | 96 ++++++++--------------------------------------
 1 file changed, 15 insertions(+), 81 deletions(-)

Comments

Jeff Law Nov. 20, 2020, 11:20 p.m. UTC | #1
On 11/19/20 8:34 PM, Maciej W. Rozycki wrote:
> Regardless of the machine mode all the interlocked branches of the same
> kind, one of the two provided by the ISA, use the same RTL patterns and
> machine instructions, except for the memory operand's constraint.
>
> Remove code duplication then and make use of a mode iterator combined
> with an attribute to expand the same insn patterns with the constraint
> suitably substituted from a single template.  No functional change.
>
> 	gcc/
> 	* config/vax/builtins.md (bb_mem): New mode attribute.
> 	(jbbssiqi, jbbssihi, jbbssisi): Fold insns into...
> 	(jbbssi<mode>): ... this.
> 	(jbbcciqi, jbbccihi, jbbccisi): Likewise...
> 	(jbbcci<mode>): ... this.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/config/vax/builtins.md b/gcc/config/vax/builtins.md
index 6bce7a85add..473b44f489f 100644
--- a/gcc/config/vax/builtins.md
+++ b/gcc/config/vax/builtins.md
@@ -24,6 +24,8 @@  (define_constants
   ]
 )
 
+(define_mode_attr bb_mem [(QI "m") (HI "Q") (SI "Q")])
+
 (define_expand "ffssi2"
   [(set (match_operand:SI 0 "nonimmediate_operand" "")
 	(ffs:SI (match_operand:SI 1 "general_operand" "")))]
@@ -73,58 +75,24 @@  (define_expand "sync_lock_test_and_set<mode>"
   DONE;
 }")
 
-(define_insn "jbbssiqi"
-  [(parallel
-    [(set (pc)
-	  (if_then_else
-	    (ne (zero_extract:SI (match_operand:QI 0 "memory_operand" "g")
-				 (const_int 1)
-				 (match_operand:SI 1 "general_operand" "nrm"))
-		(const_int 0))
-	    (label_ref (match_operand 2 "" ""))
-	    (pc)))
-     (set (zero_extract:SI (match_operand:QI 3 "memory_operand" "+0")
-			   (const_int 1)
-			   (match_dup 1))
-	  (const_int 1))])]
-  ""
-  "jbssi %1,%0,%l2")
-
-(define_insn "jbbssihi"
+(define_insn "jbbssi<mode>"
   [(parallel
     [(set (pc)
 	  (if_then_else
-	    (ne (zero_extract:SI (match_operand:HI 0 "memory_operand" "Q")
-				 (const_int 1)
-				 (match_operand:SI 1 "general_operand" "nrm"))
-		(const_int 0))
-	    (label_ref (match_operand 2 "" ""))
-	    (pc)))
-     (set (zero_extract:SI (match_operand:HI 3 "memory_operand" "+0")
-			   (const_int 1)
-			   (match_dup 1))
-	  (const_int 1))])]
-  ""
-  "jbssi %1,%0,%l2")
-
-(define_insn "jbbssisi"
-  [(parallel
-    [(set (pc)
-	  (if_then_else
-	    (ne (zero_extract:SI (match_operand:SI 0 "memory_operand" "Q")
-				 (const_int 1)
-				 (match_operand:SI 1 "general_operand" "nrm"))
-		(const_int 0))
+	    (eq (zero_extract:SI
+		  (match_operand:VAXint 0 "memory_operand" "<bb_mem>")
+		  (const_int 1)
+		  (match_operand:SI 1 "general_operand" "nrmT"))
+		(const_int 1))
 	    (label_ref (match_operand 2 "" ""))
 	    (pc)))
-     (set (zero_extract:SI (match_operand:SI 3 "memory_operand" "+0")
+     (set (zero_extract:SI (match_operand:VAXint 3 "memory_operand" "+0")
 			   (const_int 1)
 			   (match_dup 1))
 	  (const_int 1))])]
   ""
   "jbssi %1,%0,%l2")
 
-
 (define_expand "sync_lock_release<mode>"
   [(set (match_operand:VAXint 0 "memory_operand" "+m")
 	(unspec:VAXint [(match_operand:VAXint 1 "const_int_operand" "n")
@@ -145,54 +113,20 @@  (define_expand "sync_lock_release<mode>"
   DONE;
 }")
 
-(define_insn "jbbcciqi"
-  [(parallel
-    [(set (pc)
-	  (if_then_else
-	    (eq (zero_extract:SI (match_operand:QI 0 "memory_operand" "g")
-				 (const_int 1)
-				 (match_operand:SI 1 "general_operand" "nrm"))
-		(const_int 0))
-	    (label_ref (match_operand 2 "" ""))
-	    (pc)))
-     (set (zero_extract:SI (match_operand:QI 3 "memory_operand" "+0")
-			   (const_int 1)
-			   (match_dup 1))
-	  (const_int 0))])]
-  ""
-  "jbcci %1,%0,%l2")
-
-(define_insn "jbbccihi"
+(define_insn "jbbcci<mode>"
   [(parallel
     [(set (pc)
 	  (if_then_else
-	    (eq (zero_extract:SI (match_operand:HI 0 "memory_operand" "Q")
-				 (const_int 1)
-				 (match_operand:SI 1 "general_operand" "nrm"))
+	    (eq (zero_extract:SI
+		  (match_operand:VAXint 0 "memory_operand" "<bb_mem>")
+		  (const_int 1)
+		  (match_operand:SI 1 "general_operand" "nrmT"))
 		(const_int 0))
 	    (label_ref (match_operand 2 "" ""))
 	    (pc)))
-     (set (zero_extract:SI (match_operand:HI 3 "memory_operand" "+0")
+     (set (zero_extract:SI (match_operand:VAXint 3 "memory_operand" "+0")
 			   (const_int 1)
 			   (match_dup 1))
 	  (const_int 0))])]
   ""
   "jbcci %1,%0,%l2")
-
-(define_insn "jbbccisi"
-  [(parallel
-    [(set (pc)
-	  (if_then_else
-	    (eq (zero_extract:SI (match_operand:SI 0 "memory_operand" "Q")
-				 (const_int 1)
-				 (match_operand:SI 1 "general_operand" "nrm"))
-		(const_int 0))
-	    (label_ref (match_operand 2 "" ""))
-	    (pc)))
-     (set (zero_extract:SI (match_operand:SI 3 "memory_operand" "+0")
-			   (const_int 1)
-			   (match_dup 1))
-	  (const_int 0))])]
-  ""
-  "jbcci %1,%0,%l2")
-