[10/31] VAX: Use an int iterator to produce individual interlocked branches

Message ID alpine.LFD.2.21.2011200246580.656242@eddie.linux-mips.org
State New
Headers show
Series
  • VAX: Bring the port up to date (yes, MODE_CC conversion is included)
Related show

Commit Message

Maciej W. Rozycki Nov. 20, 2020, 3:34 a.m.
With mode-specific interlocked branch insns already folded into iterated
templates now fold the two templates into one too, observing that the
only difference between them is the value of the bit branched on, which
is of course reflected both in the RTL expression and the instruction
produced.  Use an int iterator to iterate over the bit value, making use
of the newly-added wide integer support, and substituting patterns as
necessary to produce equivalent individual insns.  No functional change.

	gcc/
	* config/vax/builtins.md (bit): New int iterator.
	(ccss): New int attribute.
	(jbbssi<mode>, jbbcci<mode>): Fold insns into...
	(jbb<ccss>i<mode>): ... this.
---
 gcc/config/vax/builtins.md | 29 +++++++----------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

-- 
2.11.0

Comments

Jose E. Marchesi via Gcc-patches Nov. 20, 2020, 11:20 p.m. | #1
On 11/19/20 8:34 PM, Maciej W. Rozycki wrote:
> With mode-specific interlocked branch insns already folded into iterated

> templates now fold the two templates into one too, observing that the

> only difference between them is the value of the bit branched on, which

> is of course reflected both in the RTL expression and the instruction

> produced.  Use an int iterator to iterate over the bit value, making use

> of the newly-added wide integer support, and substituting patterns as

> necessary to produce equivalent individual insns.  No functional change.

>

> 	gcc/

> 	* config/vax/builtins.md (bit): New int iterator.

> 	(ccss): New int attribute.

> 	(jbbssi<mode>, jbbcci<mode>): Fold insns into...

> 	(jbb<ccss>i<mode>): ... this.

 OK
jeff

Patch

diff --git a/gcc/config/vax/builtins.md b/gcc/config/vax/builtins.md
index 473b44f489f..8bbcd603d13 100644
--- a/gcc/config/vax/builtins.md
+++ b/gcc/config/vax/builtins.md
@@ -26,6 +26,9 @@  (define_constants
 
 (define_mode_attr bb_mem [(QI "m") (HI "Q") (SI "Q")])
 
+(define_int_iterator bit [0 1])
+(define_int_attr ccss [(0 "cc") (1 "ss")])
+
 (define_expand "ffssi2"
   [(set (match_operand:SI 0 "nonimmediate_operand" "")
 	(ffs:SI (match_operand:SI 1 "general_operand" "")))]
@@ -75,24 +78,6 @@  (define_expand "sync_lock_test_and_set<mode>"
   DONE;
 }")
 
-(define_insn "jbbssi<mode>"
-  [(parallel
-    [(set (pc)
-	  (if_then_else
-	    (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: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")
@@ -113,7 +98,7 @@  (define_expand "sync_lock_release<mode>"
   DONE;
 }")
 
-(define_insn "jbbcci<mode>"
+(define_insn "jbb<ccss>i<mode>"
   [(parallel
     [(set (pc)
 	  (if_then_else
@@ -121,12 +106,12 @@  (define_insn "jbbcci<mode>"
 		  (match_operand:VAXint 0 "memory_operand" "<bb_mem>")
 		  (const_int 1)
 		  (match_operand:SI 1 "general_operand" "nrmT"))
-		(const_int 0))
+		(const_int bit))
 	    (label_ref (match_operand 2 "" ""))
 	    (pc)))
      (set (zero_extract:SI (match_operand:VAXint 3 "memory_operand" "+0")
 			   (const_int 1)
 			   (match_dup 1))
-	  (const_int 0))])]
+	  (const_int bit))])]
   ""
-  "jbcci %1,%0,%l2")
+  "jb<ccss>i %1,%0,%l2")