re PR c/10083 (alpha: ICE while building swi-prolog-packages)
authorRichard Henderson <rth@redhat.com>
Sun, 30 Mar 2003 19:00:12 +0000 (11:00 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 30 Mar 2003 19:00:12 +0000 (11:00 -0800)
        PR c/10083
        * config/alpha/alpha.md (umuldi3_highpart): Change to expander;
        don't zero_extend const inputs.
* gcc.c-torture/compile/20030330-1.c: New.

From-SVN: r65047

gcc/ChangeLog
gcc/config/alpha/alpha.md
gcc/testsuite/gcc.c-torture/compile/20030330-1.c [new file with mode: 0644]

index c38187b764ba2ba851faf27bb355a3b1e3fc0e34..7c5433c39dcf5632620589ad800de96d5846028c 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-30  Richard Henderson  <rth@redhat.com>
+
+       PR c/10083
+       * config/alpha/alpha.md (umuldi3_highpart): Change to expander;
+       don't zero_extend const inputs.
+
 2003-03-30  Kazu Hirata  <kazu@cs.umass.edu>
 
        * reload1.c (reload_cse_move2add): Fix a comment typo.
index b4518df1662a7197343b7a8dcc3b5a94e8a56db9..8ae7aca27472d777e15720256417f0746c4a0e39 100644 (file)
@@ -750,17 +750,31 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
   "mulqv %r1,%2,%0"
   [(set_attr "type" "imul")])
 
-(define_insn "umuldi3_highpart"
+(define_expand "umuldi3_highpart"
+  [(set (match_operand:DI 0 "register_operand" "")
+       (truncate:DI
+        (lshiftrt:TI
+         (mult:TI (zero_extend:TI
+                    (match_operand:DI 1 "register_operand" ""))
+                  (match_operand:DI 2 "reg_or_8bit_operand" ""))
+         (const_int 64))))]
+  ""
+{
+  if (REG_P (operands[2]))
+    operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
+})
+
+(define_insn "*umuldi3_highpart_reg"
   [(set (match_operand:DI 0 "register_operand" "=r")
        (truncate:DI
         (lshiftrt:TI
          (mult:TI (zero_extend:TI
-                    (match_operand:DI 1 "reg_or_0_operand" "%rJ"))
+                    (match_operand:DI 1 "register_operand" "r"))
                   (zero_extend:TI
-                    (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
+                    (match_operand:DI 2 "register_operand" "r")))
          (const_int 64))))]
   ""
-  "umulh %r1,%2,%0"
+  "umulh %1,%2,%0"
   [(set_attr "type" "imul")
    (set_attr "opsize" "udi")])
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030330-1.c b/gcc/testsuite/gcc.c-torture/compile/20030330-1.c
new file mode 100644 (file)
index 0000000..a5d5de2
--- /dev/null
@@ -0,0 +1,7 @@
+/* PR c/10083 */
+/* This will result in a very small constant for umul_highpart, which
+   uncovered a bug in the Alpha machine description.  */
+
+unsigned long f(unsigned long x) {
+    return x % 0x3fffffffffffffff;
+}