Fixed 16-bit widening multiplies by a constant by limiting constant
matches to 16 bit constants.  Applied.

        PR target/54950
        * config/m32c/predicates.md (m32c_const_u16_operand): New.
        * config/m32c/muldiv.md: Use it.

Index: config/m32c/predicates.md
===================================================================
--- config/m32c/predicates.md   (revision 192552)
+++ config/m32c/predicates.md   (working copy)
@@ -293,3 +293,7 @@
 (define_predicate "m32c_1mask16_operand"
   (and (match_operand 0 "const_int_operand")
        (match_test "m32c_const_ok_for_constraint_p(INTVAL(op), 'I', 
\"Imw\")")))
+
+(define_predicate "m32c_const_u16_operand"
+  (and (match_operand 0 "const_int_operand")
+       (match_test "fprintf(stderr, \"u16=%d\\n\", INTVAL(op)),INTVAL (op) >= 
0 && INTVAL (op) <= 65535")))
Index: config/m32c/muldiv.md
===================================================================
--- config/m32c/muldiv.md       (revision 192552)
+++ config/m32c/muldiv.md       (working copy)
@@ -108,7 +108,7 @@
 (define_insn "umulhisi3_c"
   [(set (match_operand:SI 0 "ra_operand" "=Rsi")
         (mult:SI (zero_extend:SI (match_operand:HI 1 "mra_operand" "%0"))
-                 (match_operand 2 "immediate_operand" "i")))]
+                 (match_operand 2 "m32c_const_u16_operand" "i")))]
   ""
   "mulu.w\t%u2,%1"
   [(set_attr "flags" "o")]

Reply via email to