OSDN Git Service

* vax.md (casesi): Swap arguments in "(plus:SI (pc) (mult))". Reformat.
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Nov 2001 22:24:23 +0000 (22:24 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Nov 2001 22:24:23 +0000 (22:24 +0000)
(casesi1): Likewise.  Define new pattern which arises by simplification
when operand 1 is a constant int.  Correct pattern which arises by
simplification when operand 1 is zero.

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

gcc/ChangeLog
gcc/config/vax/vax.md

index 71db162..fc249e5 100644 (file)
@@ -1,3 +1,10 @@
+2001-11-16  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * vax.md (casesi): Swap arguments in "(plus:SI (pc) (mult))". Reformat.
+       (casesi1): Likewise.  Define new pattern which arises by simplification
+       when operand 1 is a constant int.  Correct pattern which arises by
+       simplification when operand 1 is zero.
+
 2001-11-16  David O'Brien  <obrien@FreeBSD.org>
 
        * config.gcc (arm*-*-rtems*, arm-*-coff*, armel-*-coff*,
index 0f976c7..b985c5b 100644 (file)
 ;; and pass the first 4 along to the casesi1 pattern that really does the work.
 (define_expand "casesi"
   [(set (pc)
-       (if_then_else (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
-                                    (match_operand:SI 1 "general_operand" "g"))
-                          (match_operand:SI 2 "general_operand" "g"))
-                     (plus:SI (sign_extend:SI
-                               (mem:HI
-                                (plus:SI (pc)
-                                         (mult:SI (minus:SI (match_dup 0)
-                                                            (match_dup 1))
-                                                  (const_int 2)))))
-                              (label_ref:SI (match_operand 3 "" "")))
-                     (pc)))
+       (if_then_else
+        (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
+                       (match_operand:SI 1 "general_operand" "g"))
+             (match_operand:SI 2 "general_operand" "g"))
+        (plus:SI (sign_extend:SI
+                  (mem:HI (plus:SI (mult:SI (minus:SI (match_dup 0)
+                                                      (match_dup 1))
+                                            (const_int 2))
+                                   (pc))))
+                 (label_ref:SI (match_operand 3 "" "")))
+        (pc)))
    (match_operand 4 "" "")]
   ""
   "
 
 (define_insn "casesi1"
   [(set (pc)
-       (if_then_else (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
-                                    (match_operand:SI 1 "general_operand" "g"))
-                          (match_operand:SI 2 "general_operand" "g"))
-                     (plus:SI (sign_extend:SI
-                               (mem:HI
-                                (plus:SI (pc)
-                                         (mult:SI (minus:SI (match_dup 0)
-                                                            (match_dup 1))
-                                                  (const_int 2)))))
-                              (label_ref:SI (match_operand 3 "" "")))
-                     (pc)))]
+       (if_then_else
+        (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
+                       (match_operand:SI 1 "general_operand" "g"))
+             (match_operand:SI 2 "general_operand" "g"))
+        (plus:SI (sign_extend:SI
+                  (mem:HI (plus:SI (mult:SI (minus:SI (match_dup 0)
+                                                      (match_dup 1))
+                                            (const_int 2))
+                                   (pc))))
+                 (label_ref:SI (match_operand 3 "" "")))
+        (pc)))]
   ""
   "casel %0,%1,%2")
 
-;; This used to arise from the preceding by simplification
-;; if operand 1 is zero.  Perhaps it is no longer necessary.
+;; This can arise by simplification when operand 1 is a constant int.
+(define_insn ""
+  [(set (pc)
+       (if_then_else
+        (leu (plus:SI (match_operand:SI 0 "general_operand" "g")
+                      (match_operand:SI 1 "const_int_operand" "n"))
+             (match_operand:SI 2 "general_operand" "g"))
+        (plus:SI (sign_extend:SI
+                  (mem:HI (plus:SI (mult:SI (plus:SI (match_dup 0)
+                                                     (match_dup 1))
+                                            (const_int 2))
+                                   (pc))))
+                 (label_ref:SI (match_operand 3 "" "")))
+        (pc)))]
+  ""
+  "*
+{
+  operands[1] = GEN_INT (-INTVAL (operands[1]));
+  return \"casel %0,%1,%2\";
+}")
+
+;; This can arise by simplification when the base for the case insn is zero.
 (define_insn ""
   [(set (pc)
        (if_then_else (leu (match_operand:SI 0 "general_operand" "g")
                           (match_operand:SI 1 "general_operand" "g"))
                      (plus:SI (sign_extend:SI
-                               (mem:HI
-                                (plus:SI (pc)
-                                         (mult:SI (minus:SI (match_dup 0)
-                                                            (const_int 0))
-                                                  (const_int 2)))))
+                               (mem:HI (plus:SI (mult:SI (match_dup 0)
+                                                         (const_int 2))
+                                       (pc))))
                               (label_ref:SI (match_operand 2 "" "")))
                      (pc)))]
   ""