This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

alpha -ftrapv patterns


Everytime I watch libgcc2 being compiled I'm reminded that
these are so simple to do on alpha.


r~


        * config/alpha/alpha.md (addvsi3, addvdi3): New.
        (negvsi2, negvdi2, subvsi3, subvdi3, mulvsi3, mulvdi3): New.

Index: config/alpha/alpha.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.md,v
retrieving revision 1.134
diff -c -p -d -r1.134 alpha.md
*** alpha.md	2001/01/02 08:07:17	1.134
--- alpha.md	2001/01/03 22:24:16
***************
*** 582,587 ****
--- 582,601 ----
    operands[7] = gen_lowpart (SImode, operands[5]);
  }")
  
+ (define_insn "addvsi3"
+   [(set (match_operand:SI 0 "register_operand" "=r,r")
+ 	(plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
+ 		 (match_operand:SI 2 "sext_add_operand" "rI,O")))
+    (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
+ 			 (sign_extend:DI (match_dup 2)))
+ 		(sign_extend:DI (plus:SI (match_dup 1)
+ 					 (match_dup 2))))
+ 	    (const_int 0))]
+   ""
+   "@
+    addlv %r1,%2,%0
+    sublv %r1,%n2,%0")
+ 
  (define_expand "adddi3"
    [(set (match_operand:DI 0 "register_operand" "")
  	(plus:DI (match_operand:DI 1 "register_operand" "")
***************
*** 723,728 ****
--- 737,756 ----
     s%2addq %1,%3,%0
     s%2subq %1,%n3,%0")
  
+ (define_insn "addvdi3"
+   [(set (match_operand:DI 0 "register_operand" "=r,r")
+ 	(plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
+ 		 (match_operand:DI 2 "sext_add_operand" "rI,O")))
+    (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
+ 			 (sign_extend:TI (match_dup 2)))
+ 		(sign_extend:TI (plus:DI (match_dup 1)
+ 					 (match_dup 2))))
+ 	    (const_int 0))]
+   ""
+   "@
+    addqv %r1,%2,%0
+    subqv %r1,%n2,%0")
+ 
  (define_insn "negsi2"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
***************
*** 736,747 ****
--- 764,793 ----
    ""
    "subl $31,%1,%0")
  
+ (define_insn "negvsi2"
+   [(set (match_operand:SI 0 "register_operand" "=r")
+ 	(neg:SI (match_operand:SI 1 "register_operand" "r")))
+    (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
+ 		(sign_extend:DI (neg:SI (match_dup 1))))
+ 	    (const_int 0))]
+   ""
+   "sublv $31,%1,%0")
+ 
  (define_insn "negdi2"
    [(set (match_operand:DI 0 "register_operand" "=r")
  	(neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
    ""
    "subq $31,%1,%0")
  
+ (define_insn "negvdi2"
+   [(set (match_operand:DI 0 "register_operand" "=r")
+ 	(neg:DI (match_operand:DI 1 "register_operand" "r")))
+    (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
+ 		(sign_extend:TI (neg:DI (match_dup 1))))
+ 	    (const_int 0))]
+   ""
+   "subqv $31,%1,%0")
+ 
  (define_expand "subsi3"
    [(set (match_operand:SI 0 "register_operand" "")
  	(minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
***************
*** 780,785 ****
--- 826,843 ----
    ""
    "subl %r1,%2,%0")
  
+ (define_insn "subvsi3"
+   [(set (match_operand:SI 0 "register_operand" "=r")
+ 	(minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
+ 		  (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
+    (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
+ 			  (sign_extend:DI (match_dup 2)))
+ 		(sign_extend:DI (minus:SI (match_dup 1)
+ 					  (match_dup 2))))
+ 	    (const_int 0))]
+   ""
+   "sublv %r1,%2,%0")
+ 
  (define_insn "subdi3"
    [(set (match_operand:DI 0 "register_operand" "=r")
  	(minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
***************
*** 812,817 ****
--- 870,887 ----
    ""
    "s%2subq %1,%3,%0")
  
+ (define_insn "subvdi3"
+   [(set (match_operand:DI 0 "register_operand" "=r")
+ 	(minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
+ 		  (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
+    (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
+ 			  (sign_extend:TI (match_dup 2)))
+ 		(sign_extend:TI (minus:DI (match_dup 1)
+ 					  (match_dup 2))))
+ 	    (const_int 0))]
+   ""
+   "subqv %r1,%2,%0")
+ 
  (define_insn "mulsi3"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
***************
*** 831,842 ****
--- 901,939 ----
    [(set_attr "type" "imul")
     (set_attr "opsize" "si")])
  
+ (define_insn "mulvsi3"
+   [(set (match_operand:SI 0 "register_operand" "=r")
+ 	(mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
+ 		 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
+    (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
+ 			 (sign_extend:DI (match_dup 2)))
+ 		(sign_extend:DI (mult:SI (match_dup 1)
+ 					 (match_dup 2))))
+ 	    (const_int 0))]
+   ""
+   "mullv %r1,%2,%0"
+   [(set_attr "type" "imul")
+    (set_attr "opsize" "si")])
+ 
  (define_insn "muldi3"
    [(set (match_operand:DI 0 "register_operand" "=r")
  	(mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
  		 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
    ""
    "mulq %r1,%2,%0"
+   [(set_attr "type" "imul")])
+ 
+ (define_insn "mulvdi3"
+   [(set (match_operand:DI 0 "register_operand" "=r")
+ 	(mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
+ 		 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
+    (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
+ 			 (sign_extend:TI (match_dup 2)))
+ 		(sign_extend:TI (mult:DI (match_dup 1)
+ 					 (match_dup 2))))
+ 	    (const_int 0))]
+   ""
+   "mulqv %r1,%2,%0"
    [(set_attr "type" "imul")])
  
  (define_insn "umuldi3_highpart"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]