OSDN Git Service

(sne): Modified to use negc instead of xor.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Apr 1997 22:39:01 +0000 (22:39 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Apr 1997 22:39:01 +0000 (22:39 +0000)
(sne+1): New define_split for new sne pattern.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13848 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/config/sh/sh.md

index 0ff08aa..342b3e4 100644 (file)
   ""
   "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