Commit 3b800f71 by Jeff Law

mn10300.md (cmpsi): Handle comparing a register with itself by adding zero to the reg.

        * 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
parent 5ae4759c
......@@ -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;
......
......@@ -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"))
;; ----------------------------------------------------------------------
......@@ -243,11 +244,13 @@
(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")])
;; ----------------------------------------------------------------------
;; ADD INSTRUCTIONS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment