aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-11-01 17:44:19 +0000
committerRichard Stallman <rms@gnu.org>1993-11-01 17:44:19 +0000
commit0fc48de672ca06ddf326f4d2410f21b63adf04c0 (patch)
tree76df0687a0ba5fa84ed9f12e58b09fc4b9ef16b0
parent3564e40e2c1d041491de0319989296cf46a1f10c (diff)
downloadgcc-0fc48de672ca06ddf326f4d2410f21b63adf04c0.zip
gcc-0fc48de672ca06ddf326f4d2410f21b63adf04c0.tar.gz
gcc-0fc48de672ca06ddf326f4d2410f21b63adf04c0.tar.bz2
(divhisi3, udivhisi3, modhisi3, umodhi3): Comment out.
(divhisi3, udivhisi3, modhisi3, umodhi3 recognizers): Comment out. From-SVN: r5963
-rw-r--r--gcc/config/m68k/m68k.md255
1 files changed, 131 insertions, 124 deletions
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 1de4c57..910c02e 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -2715,35 +2715,39 @@
#endif
}")
-(define_insn "divhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (div:SI
- (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "*
-{
-#ifdef MOTOROLA
- return \"divs%.w %2,%0\";
-#else
- return \"divs %2,%0\";
-#endif
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "*
-{
-#ifdef MOTOROLA
- return \"divs%.w %2,%0\";
-#else
- return \"divs %2,%0\";
-#endif
-}")
+;; These patterns don't work because the divs instruction is undefined if
+;; the quotient is more than 16 bits. This valid C would be miscompiled:
+;; int n; short d; unsigned short q; ... q = (unsigned int) (n / d);
+;; Imagine what happens when n = 100000 and d = 1.
+;;(define_insn "divhisi3"
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI
+;; (div:SI
+;; (match_operand:SI 1 "general_operand" "0")
+;; (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
+;; ""
+;; "*
+;;{
+;;#ifdef MOTOROLA
+;; return \"divs%.w %2,%0\";
+;;#else
+;; return \"divs %2,%0\";
+;;#endif
+;;}")
+
+;;(define_insn ""
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI (div:SI (match_operand:SI 1 "general_operand" "0")
+;; (match_operand:SI 2 "const_int_operand" "n"))))]
+;; ""
+;; "*
+;;{
+;;#ifdef MOTOROLA
+;; return \"divs%.w %2,%0\";
+;;#else
+;; return \"divs %2,%0\";
+;;#endif
+;;}")
(define_insn "udivhi3"
[(set (match_operand:HI 0 "general_operand" "=d")
@@ -2759,35 +2763,36 @@
#endif
}")
-(define_insn "udivhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (udiv:SI
- (match_operand:SI 1 "general_operand" "0")
- (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "*
-{
-#ifdef MOTOROLA
- return \"divu%.w %2,%0\";
-#else
- return \"divu %2,%0\";
-#endif
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (udiv:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "*
-{
-#ifdef MOTOROLA
- return \"divu%.w %2,%0\";
-#else
- return \"divu %2,%0\";
-#endif
-}")
+;; See comment before divhisi3 why these are commented out.
+;;(define_insn "udivhisi3"
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI
+;; (udiv:SI
+;; (match_operand:SI 1 "general_operand" "0")
+;; (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
+;; ""
+;; "*
+;;{
+;;#ifdef MOTOROLA
+;; return \"divu%.w %2,%0\";
+;;#else
+;; return \"divu %2,%0\";
+;;#endif
+;;}")
+
+;;(define_insn ""
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI (udiv:SI (match_operand:SI 1 "general_operand" "0")
+;; (match_operand:SI 2 "const_int_operand" "n"))))]
+;; ""
+;; "*
+;;{
+;;#ifdef MOTOROLA
+;; return \"divu%.w %2,%0\";
+;;#else
+;; return \"divu %2,%0\";
+;;#endif
+;;}")
(define_expand "divdf3"
[(set (match_operand:DF 0 "general_operand" "")
@@ -2888,39 +2893,40 @@
#endif
}")
-(define_insn "modhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (mod:SI
- (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "*
-{
- /* The swap insn produces cc's that don't correspond to the result. */
- CC_STATUS_INIT;
-#ifdef MOTOROLA
- return \"divs%.w %2,%0\;swap %0\";
-#else
- return \"divs %2,%0\;swap %0\";
-#endif
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (mod:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "*
-{
- /* The swap insn produces cc's that don't correspond to the result. */
- CC_STATUS_INIT;
-#ifdef MOTOROLA
- return \"divs%.w %2,%0\;swap %0\";
-#else
- return \"divs %2,%0\;swap %0\";
-#endif
-}")
+;; See comment before divhisi3 why these are commented out.
+;;(define_insn "modhisi3"
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI
+;; (mod:SI
+;; (match_operand:SI 1 "general_operand" "0")
+;; (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
+;; ""
+;; "*
+;;{
+;; /* The swap insn produces cc's that don't correspond to the result. */
+;; CC_STATUS_INIT;
+;;#ifdef MOTOROLA
+;; return \"divs%.w %2,%0\;swap %0\";
+;;#else
+;; return \"divs %2,%0\;swap %0\";
+;;#endif
+;;}")
+
+;;(define_insn ""
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI (mod:SI (match_operand:SI 1 "general_operand" "0")
+;; (match_operand:SI 2 "const_int_operand" "n"))))]
+;; ""
+;; "*
+;;{
+;; /* The swap insn produces cc's that don't correspond to the result. */
+;; CC_STATUS_INIT;
+;;#ifdef MOTOROLA
+;; return \"divs%.w %2,%0\;swap %0\";
+;;#else
+;; return \"divs %2,%0\;swap %0\";
+;;#endif
+;;}")
(define_insn "umodhi3"
[(set (match_operand:HI 0 "general_operand" "=d")
@@ -2938,39 +2944,40 @@
#endif
}")
-(define_insn "umodhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (umod:SI
- (match_operand:SI 1 "general_operand" "0")
- (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "*
-{
- /* The swap insn produces cc's that don't correspond to the result. */
- CC_STATUS_INIT;
-#ifdef MOTOROLA
- return \"divu%.w %2,%0\;swap %0\";
-#else
- return \"divu %2,%0\;swap %0\";
-#endif
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (umod:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "*
-{
- /* The swap insn produces cc's that don't correspond to the result. */
- CC_STATUS_INIT;
-#ifdef MOTOROLA
- return \"divu%.w %2,%0\;swap %0\";
-#else
- return \"divu %2,%0\;swap %0\";
-#endif
-}")
+;; See comment before divhisi3 why these are commented out.
+;;(define_insn "umodhisi3"
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI
+;; (umod:SI
+;; (match_operand:SI 1 "general_operand" "0")
+;; (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
+;; ""
+;; "*
+;;{
+;; /* The swap insn produces cc's that don't correspond to the result. */
+;; CC_STATUS_INIT;
+;;#ifdef MOTOROLA
+;; return \"divu%.w %2,%0\;swap %0\";
+;;#else
+;; return \"divu %2,%0\;swap %0\";
+;;#endif
+;;}")
+
+;;(define_insn ""
+;; [(set (match_operand:HI 0 "general_operand" "=d")
+;; (truncate:HI (umod:SI (match_operand:SI 1 "general_operand" "0")
+;; (match_operand:SI 2 "const_int_operand" "n"))))]
+;; ""
+;; "*
+;;{
+;; /* The swap insn produces cc's that don't correspond to the result. */
+;; CC_STATUS_INIT;
+;;#ifdef MOTOROLA
+;; return \"divu%.w %2,%0\;swap %0\";
+;;#else
+;; return \"divu %2,%0\;swap %0\";
+;;#endif
+;;}")
(define_insn "divmodsi4"
[(set (match_operand:SI 0 "general_operand" "=d")