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]
Other format: [Raw text]

Add TImode calculation


With this patch, one can add and subtract 128 bit integers.

2001-12-03  Bo Thorsen  <bo@suse.co.uk>

	* config/i386/i386.md: Add TImode addition and subtraction for
	x86-64.

Index: config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.318
diff -u -r1.318 i386.md
--- i386.md	2001/12/03 12:54:59	1.318
+++ i386.md	2001/12/03 13:48:22
@@ -5275,6 +5275,39 @@
 ;	(plus:DI (match_operand:DI 1 "general_operand" "")
 ;		 (zero_extend:DI (match_operand:SI 2 "general_operand" ""))))]
 
+(define_expand "addti3"
+  [(set (match_operand:TI 0 "nonimmediate_operand" "")
+	(plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
+		 (match_operand:TI 2 "x86_64_general_operand" "")))
+   (clobber (reg:CC 17))]
+  "TARGET_64BIT"
+  "ix86_expand_binary_operator (PLUS, TImode, operands); DONE;")
+
+(define_insn "*addti3_1"
+  [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
+	(plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0,0")
+		 (match_operand:TI 2 "general_operand" "roi,ri")))
+   (clobber (reg:CC 17))]
+  "TARGET_64BIT && ix86_binary_operator_ok (PLUS, TImode, operands)"
+  "#")
+
+(define_split
+  [(set (match_operand:TI 0 "nonimmediate_operand" "")
+	(plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
+		 (match_operand:TI 2 "general_operand" "")))
+   (clobber (reg:CC 17))]
+  "reload_completed && TARGET_64BIT"
+  [(parallel [(set (reg:CC 17) (unspec:CC [(match_dup 1) (match_dup 2)] 12))
+	      (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))])
+   (parallel [(set (match_dup 3)
+		   (plus:DI (plus:DI (ltu:DI (reg:CC 17) (const_int 0))
+				     (match_dup 4))
+			    (match_dup 5)))
+	      (clobber (reg:CC 17))])]
+  "split_ti (operands+0, 1, operands+0, operands+3);
+   split_ti (operands+1, 1, operands+1, operands+4);
+   split_ti (operands+2, 1, operands+2, operands+5);")
+
 (define_expand "adddi3"
   [(set (match_operand:DI 0 "nonimmediate_operand" "")
 	(plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
@@ -6901,6 +6934,39 @@
   "")
 
 ;; Subtract instructions
+
+(define_expand "subti3"
+  [(parallel [(set (match_operand:TI 0 "nonimmediate_operand" "")
+		   (minus:TI (match_operand:TI 1 "nonimmediate_operand" "")
+			     (match_operand:TI 2 "x86_64_general_operand" "")))
+	      (clobber (reg:CC 17))])]
+  "TARGET_64BIT"
+  "ix86_expand_binary_operator (MINUS, TImode, operands); DONE;")
+
+(define_insn "*subti3_1"
+  [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
+	(minus:TI (match_operand:TI 1 "nonimmediate_operand" "0,0")
+		  (match_operand:TI 2 "general_operand" "roi,ri")))
+   (clobber (reg:CC 17))]
+  "TARGET_64BIT && ix86_binary_operator_ok (PLUS, TImode, operands)"
+  "#")
+
+(define_split
+  [(set (match_operand:TI 0 "nonimmediate_operand" "")
+	(minus:TI (match_operand:TI 1 "nonimmediate_operand" "")
+		  (match_operand:TI 2 "general_operand" "")))
+   (clobber (reg:CC 17))]
+  "reload_completed && TARGET_64BIT"
+  [(parallel [(set (reg:CC 17) (compare:CC (match_dup 1) (match_dup 2)))
+	      (set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))])
+   (parallel [(set (match_dup 3)
+		   (minus:DI (match_dup 4)
+			     (plus:DI (ltu:DI (reg:CC 17) (const_int 0))
+				      (match_dup 5))))
+	      (clobber (reg:CC 17))])]
+  "split_ti (operands+0, 1, operands+0, operands+3);
+   split_ti (operands+1, 1, operands+1, operands+4);
+   split_ti (operands+2, 1, operands+2, operands+5);")
 
 ;; %%% splits for subsidi3
 
Bo

-- 

     Bo Thorsen                 |   Praestevejen 4
     Free software developer    |   5290 Marslev
     SuSE Labs                  |   Denmark


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