* Fix vax casesi patterns
@ 2001-11-13 15:03 John David Anglin
0 siblings, 0 replies; only message in thread
From: John David Anglin @ 2001-11-13 15:03 UTC (permalink / raw)
To: gcc-patches
The following corrects problems noted with the vax casesi pattern. Apparently,
the simplification of MINUS was broken for many years. When this was fixed
a few months ago on the main, it exposed the fact that the operands in
the vax pattern weren't in the standard order, and also different simplification
patterns were needed.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
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.
--- vax.md.orig Thu Aug 9 22:09:24 2001
+++ vax.md Tue Oct 2 13:57:00 2001
@@ -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)))]
""
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-11-16 22:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13 15:03 Fix vax casesi patterns John David Anglin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).