mn10300.md (cmpsi): Handle comparing a register with itself by adding zero to the...
authorJeff Law <law@gcc.gnu.org>
Thu, 20 Mar 1997 19:25:46 +0000 (12:25 -0700)
committerJeff Law <law@gcc.gnu.org>
Thu, 20 Mar 1997 19:25:46 +0000 (12:25 -0700)
        * mn10300/mn10300.md (cmpsi): Handle comparing a register with
        itself by adding zero to the reg.  Z bit for such an insn is
        inverted.
        * mn10300/mn10300.c (notice_update_cc): Handle CC_INVERT.

From-SVN: r13755

gcc/config/mn10300/mn10300.c
gcc/config/mn10300/mn10300.md

index 027a8e7a02ff0185f904ba036b51df9c7be3b6d1..517a560d2c4d897294ddc19524b505e1c4fb2c0e 100644 (file)
@@ -442,6 +442,13 @@ notice_update_cc (body, insn)
       cc_status.value1 = SET_SRC (body);
       break;
 
+    case CC_INVERT:
+      /* The insn is a compare instruction.  */
+      CC_STATUS_INIT;
+      cc_status.value1 = SET_SRC (body);
+      cc_status.flags |= CC_INVERTED;
+      break;
+
     case CC_CLOBBER:
       /* Insn doesn't leave CC in a usable state.  */
       CC_STATUS_INIT;
index bdc65c82a4d82d596c32e2099e042634dd65f572..477e99f3c9ccad41ed909487d54902e0bb1af664 100644 (file)
@@ -35,8 +35,9 @@
 ;; set_zn_c0 - insn sets z,n to usable values.  v is unknown.  c may or may not
 ;;     be known (if it isn't that's ok, we don't need it anyway).
 ;; compare - compare instruction
+;; invert -- like compare, but flags are inverted.
 ;; clobber - value of cc is unknown
-(define_attr "cc" "none,none_0hit,tst,set_zn_c0,compare,clobber"
+(define_attr "cc" "none,none_0hit,tst,set_zn_c0,compare,clobber,invert"
   (const_string "clobber"))
 \f
 ;; ----------------------------------------------------------------------
 
 (define_insn "cmpsi"
   [(set (cc0)
-       (compare (match_operand:SI 0 "register_operand" "da")
-                (match_operand:SI 1 "nonmemory_operand" "dai")))]
+       (compare (match_operand:SI 0 "register_operand" "!*d*a,da")
+                (match_operand:SI 1 "nonmemory_operand" "!*0,dai")))]
   ""
-  "cmp %1,%0"
-  [(set_attr "cc" "compare")])
+  "@
+  add 0,%0
+  cmp %1,%0"
+  [(set_attr "cc" "invert,compare")])
 \f
 ;; ----------------------------------------------------------------------
 ;; ADD INSTRUCTIONS