summaryrefslogtreecommitdiff
path: root/gcc/config/sh
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1997-04-10 15:39:01 -0700
committerJim Wilson <wilson@gcc.gnu.org>1997-04-10 15:39:01 -0700
commit8bca10f462ac3981b5e1a3ad8d6592618aa72961 (patch)
tree30afda86f147bb2eef659e3888aabaf7e2b0b8c5 /gcc/config/sh
parentf3cd53755be56e7d6a05687789916f072ba8e9ab (diff)
downloadgcc-8bca10f462ac3981b5e1a3ad8d6592618aa72961.tar.gz
(sne): Modified to use negc instead of xor.
(sne+1): New define_split for new sne pattern. From-SVN: r13848
Diffstat (limited to 'gcc/config/sh')
-rw-r--r--gcc/config/sh/sh.md35
1 files 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