summaryrefslogtreecommitdiff
path: root/gcc/config/vax/vax.md
diff options
context:
space:
mode:
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-16 22:24:23 +0000
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-16 22:24:23 +0000
commit987e17b6698c139df343ca5cf6aa04960d9c81c8 (patch)
treee9c6af6e4540df4a9a72efdc8f9bd65975599814 /gcc/config/vax/vax.md
parent81cea2ab9c2eea5de9e6af8358d4c8b0be4b2b98 (diff)
downloadgcc-987e17b6698c139df343ca5cf6aa04960d9c81c8.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47109 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/vax/vax.md')
-rw-r--r--gcc/config/vax/vax.md76
1 files changed, 47 insertions, 29 deletions
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)))]
""