Hi DJ,
> "umul" is used when the insn takes two operands in A and X, and computes a 
> value into AX.  
> "macax" is used when the insn pattern itself reads from two virtual registers 
> and writes to a 
> virtual register (i.e. V = V op V), but clobbers AX anx BC in the process.

Thanks for the clarification.
I have updated the patch as below, adding "macax" for *mulhi3_rl78 pattern, 
while the other 2 use "umul"
Let me know if below modified patch is OK to commit.

Regards,
Kaushik

Index: gcc/config/rl78/constraints.md
===================================================================
--- gcc/config/rl78/constraints.md      (revision 199949)
+++ gcc/config/rl78/constraints.md      (working copy)
@@ -256,6 +256,19 @@
        (match_test "!rl78_far_p (op) && rl78_as_legitimate_address (VOIDmode, 
XEXP (op, 0), true, ADDR_SPACE_GENERIC)"))
 )
 
+(define_memory_constraint "U"
+  "memory references valid with mov to/from a/ax"
+  (and (match_code "mem")
+       (match_test "rl78_virt_insns_ok ()
+|| satisfies_constraint_Wab (op)
+|| satisfies_constraint_Wbc (op)
+|| satisfies_constraint_Wde (op)
+|| satisfies_constraint_Wd2 (op)
+|| satisfies_constraint_Whl (op)
+|| satisfies_constraint_Wh1 (op)
+|| satisfies_constraint_Whb (op)
+|| satisfies_constraint_Ws1 (op)
+|| satisfies_constraint_Wfr (op) ")))
 
 (define_memory_constraint "Qbi"
   "built-in compare types"
Index: gcc/config/rl78/rl78.md
===================================================================
--- gcc/config/rl78/rl78.md     (revision 199949)
+++ gcc/config/rl78/rl78.md     (working copy)
@@ -276,6 +276,7 @@
        mov    a, x
        mov    %h0, a
        ; end of mulqi macro"
+;;  [(set_attr "valloc" "umul")]
 )
 
 (define_insn "*mulhi3_rl78"
@@ -290,6 +291,7 @@
        mulhu   ; bcax = bc * ax
        movw    %h0, ax
        ; end of mulhi macro"
+;;  [(set_attr "valloc" "macax")]
 )
 
 (define_insn "*mulhi3_g13"
@@ -309,6 +311,7 @@
        movw    ax, 0xffff6     ; MDBL
        movw    %h0, ax
         ; end of mulhi macro"
+;;  [(set_attr "valloc" "umul")]
 )
 
 ;; 0xFFFF0 is MACR(L).  0xFFFF2 is MACR(H) but we don't care about it


Reply via email to