From 952e42d8d0c58e0fbcd89e3ab9b3f38f435f9aa7 Mon Sep 17 00:00:00 2001 From: law Date: Thu, 20 Mar 1997 19:25:46 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13755 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/mn10300/mn10300.c | 7 +++++++ gcc/config/mn10300/mn10300.md | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 027a8e7a02f..517a560d2c4 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 bdc65c82a4d..477e99f3c9c 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 -- 2.11.4.GIT