Rotates on the PA

Jeffrey A Law law@upchuck.cygnus.com
Wed Mar 24 00:28:00 GMT 1999


This brings back support for rotl on the PA.

It had previously been removed because the rotlsi3 pattern did not support
variable rotates (which is a no-no for the named rotate patterns).

This patch includes support for a variable rotate left (synthesized using a
variable rotate right).

[ I'm evaluating Geoff's rotate patch, which got me looking at this stuff... ]


	* pa.md (rotlsi3): New expander.  Synthesize a variable rotate
	left using a variable rotate right.  Provide anonymous pattern for
	rotate left by a constant value.

Index: pa.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/pa/pa.md,v
retrieving revision 1.22
diff -c -3 -p -r1.22 pa.md
*** pa.md	1999/03/17 20:15:18	1.22
--- pa.md	1999/03/24 08:24:02
***************
*** 3901,3906 ****
--- 3901,3936 ----
    [(set_attr "type" "shift")
     (set_attr "length" "4")])
  
+ (define_expand "rotlsi3"
+   [(set (match_operand:SI 0 "register_operand" "")
+         (rotate:SI (match_operand:SI 1 "register_operand" "")
+                    (match_operand:SI 2 "arith32_operand" "")))]
+   ""
+   "
+ {
+   if (GET_CODE (operands[2]) != CONST_INT)
+     {
+       rtx temp = gen_reg_rtx (SImode);
+       emit_insn (gen_subsi3 (temp, GEN_INT (32), operands[2]));
+       emit_insn (gen_rotrsi3 (operands[0], operands[1], temp));
+       DONE;
+     }
+   /* Else expand normally.  */
+ }")
+ 
+ (define_insn ""
+   [(set (match_operand:SI 0 "register_operand" "=r")
+         (rotate:SI (match_operand:SI 1 "register_operand" "r")
+                    (match_operand:SI 2 "const_int_operand" "n")))]
+   ""
+   "*
+ {
+   operands[2] = GEN_INT ((32 - INTVAL (operands[2])) & 31);
+   return \"shd %1,%1,%2,%0\";
+ }"
+   [(set_attr "type" "shift")
+    (set_attr "length" "4")])
+ 
  (define_insn ""
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(match_operator:SI 5 "plus_xor_ior_operator"


More information about the Gcc-patches mailing list