diff mbox

m32c: fix pr54950

Message ID 201210180150.q9I1oTeR003007@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie Oct. 18, 2012, 1:50 a.m. UTC
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.

Comments

Ramana Radhakrishnan Oct. 18, 2012, 5:50 a.m. UTC | #1
On 18 Oct 2012, at 02:50, DJ Delorie <dj@redhat.com> wrote:

> 
> 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")))


Are you sure you meant to have an fprintf in a match_test ?


Ramana
> 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")]
DJ Delorie Oct. 18, 2012, 5:59 a.m. UTC | #2
> Are you sure you meant to have an fprintf in a match_test ?

I definitely did not.  Removed.  Thanks!
diff mbox

Patch

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")]