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]

Blackfin subsi3 patch


This fixes some bogosities with the subsi3 predicates in bfin.md. Committed as 117455.


Bernd


Index: ChangeLog
===================================================================
--- ChangeLog	(revision 117454)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2006-10-05  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* config/bfin/bfin.md (subsi3): Lose expander, change previously
+	unnamed pattern into subsi3.  Use correct constraints/predicates.
+	* config/bfin/bfin.h (CONST_OK_FOR_K): Handle "KN7".
+	* config/bfin/predicates.md (reg_or_neg7bit_operand_p): New.
+
 2006-10-05  Ira Rosen  <irar@il.ibm.com>
 
 	* doc/loop.texi: Add data references analysis description.
Index: config/bfin/predicates.md
===================================================================
--- config/bfin/predicates.md	(revision 117454)
+++ config/bfin/predicates.md	(working copy)
@@ -114,6 +114,13 @@ (define_predicate "nondp_reg_or_memory_o
   (ior (match_operand 0 "nondp_register_operand")
        (match_operand 0 "memory_operand")))
 
+;; Return nonzero if OP is a register or, when negated, a 7 bit signed
+;; constant.
+(define_predicate "reg_or_neg7bit_operand"
+  (ior (match_operand 0 "register_operand")
+       (and (match_code "const_int")
+	    (match_test "CONST_7BIT_IMM_P (-INTVAL (op))"))))
+
 ;; Used for secondary reloads, this function returns 1 if OP is of the
 ;; form (plus (fp) (const_int)).
 (define_predicate "fp_plus_const_operand"
Index: config/bfin/bfin.h
===================================================================
--- config/bfin/bfin.h	(revision 117454)
+++ config/bfin/bfin.h	(working copy)
@@ -1063,6 +1063,9 @@ do {                                    
      : (STR)[1] == 'n'					\
      ? ((STR)[2] == '7' ? CONST_7NBIT_IMM_P (VALUE)	\
 	: 0)						\
+     : (STR)[1] == 'N'					\
+     ? ((STR)[2] == '7' ? CONST_7BIT_IMM_P (-(VALUE))	\
+	: 0)						\
      : 0)
 
 #define CONST_OK_FOR_M(VALUE, STR)			\
Index: config/bfin/bfin.md
===================================================================
--- config/bfin/bfin.md	(revision 117454)
+++ config/bfin/bfin.md	(working copy)
@@ -1083,18 +1083,11 @@ (define_insn "ssaddsi3"
   "%0 = %1 + %2 (S);"
   [(set_attr "type" "dsp32")])
 
-(define_expand "subsi3"
-  [(set (match_operand:SI 0 "register_operand" "")
-	(minus:SI (match_operand:SI 1 "register_operand" "")
-		  (match_operand:SI 2 "reg_or_7bit_operand" "")))]
-  ""
-  "")
-
-(define_insn ""
+(define_insn "subsi3"
   [(set (match_operand:SI 0 "register_operand" "=da,d,a")
 	(minus:SI (match_operand:SI 1 "register_operand" "0,d,0")
-		  (match_operand:SI 2 "reg_or_7bit_operand" "Ks7,d,a")))]
-  "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -64"
+		  (match_operand:SI 2 "reg_or_neg7bit_operand" "KN7,d,a")))]
+  ""
 {
   static const char *const strings_subsi3[] = {
     "%0 += -%2;",

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