From 8bca10f462ac3981b5e1a3ad8d6592618aa72961 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Thu, 10 Apr 1997 15:39:01 -0700 Subject: [PATCH] (sne): Modified to use negc instead of xor. (sne+1): New define_split for new sne pattern. From-SVN: r13848 --- gcc/config/sh/sh.md | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 0ff08aad635..342b3e40911 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -2287,12 +2287,41 @@ "" "operands[1] = prepare_scc_operands (GEU);") +;; sne moves the complement of the T reg to DEST like this: +;; cmp/eq ... +;; mov #-1,temp +;; negc temp,dest +;; This is better than xoring compare result with 1 because it does +;; not require r0 and further, the -1 may be CSE-ed or lifted out of a +;; loop. + (define_expand "sne" + [(set (match_dup 2) (const_int -1)) + (parallel [(set (match_operand:SI 0 "arith_reg_operand" "") + (neg:SI (plus:SI (match_dup 1) + (match_dup 2)))) + (set (reg:SI 18) + (ne:SI (ior:SI (match_dup 1) (match_dup 2)) + (const_int 0)))])] + "" + " +{ + operands[1] = prepare_scc_operands (EQ); + operands[2] = gen_reg_rtx (SImode); +}") + +;; Recognize mov #-1/negc/neg sequence, and change it to movt/add #-1. +;; This prevents a regression that occured when we switched from xor to +;; mov/neg for sne. + +(define_split [(set (match_operand:SI 0 "arith_reg_operand" "") - (match_dup 1)) - (set (match_dup 0) (xor:SI (match_dup 0) (const_int 1)))] + (plus:SI (reg:SI 18) + (const_int -1)))] "" - "operands[1] = prepare_scc_operands (EQ);") + [(set (match_dup 0) (eq:SI (reg:SI 18) (const_int 1))) + (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))] + "") ;; ------------------------------------------------------------------------- ;; Instructions to cope with inline literal tables -- 2.30.2