From 3b800f71d378c8bfc24cc96160bab8af7a35e676 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 20 Mar 1997 12:25:46 -0700 Subject: 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 --- gcc/config/mn10300/mn10300.c | 7 +++++++ gcc/config/mn10300/mn10300.md | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 027a8e7..517a560 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -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; diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md index bdc65c8..477e99f 100644 --- a/gcc/config/mn10300/mn10300.md +++ b/gcc/config/mn10300/mn10300.md @@ -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 -- cgit v1.1