summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/vax/vax.md76
2 files changed, 54 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 71db16261b2..fc249e5c565 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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*,
diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md
index 0f976c7b952..b985c5b6a5d 100644
--- a/gcc/config/vax/vax.md
+++ b/gcc/config/vax/vax.md
@@ -1958,17 +1958,17 @@
;; 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 "" "")]
""
"
@@ -1978,32 +1978,50 @@
(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)))]
""