Patchwork new mul* patterns "U" constraint in rl78

login
register
mail settings
Submitter Kaushik Phatak
Date June 11, 2013, 1:51 p.m.
Message ID <C6CA53A2A46BA7469348BDBD663AB6585308E067@KCHJEXMB02.kpit.com>
Download mbox | patch
Permalink /patch/250549/
State New
Headers show

Comments

Kaushik Phatak - June 11, 2013, 1:51 p.m.
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
DJ Delorie - June 11, 2013, 3:24 p.m.
>  	; end of mulqi macro"
> +;;  [(set_attr "valloc" "umul")]

I think this one needs to be macax also, since the constraints have
"v" in them but the opcodes use ax.

Other than that, it's OK.
Kaushik Phatak - June 12, 2013, 4:43 a.m.
>> +;;  [(set_attr "valloc" "umul")]
>I think this one needs to be macax also, since the constraints have "v" in them but the opcodes use ax.
> Other than that, it's OK.

Committed with above change.

Thanks for the quick review.

Regards,
Kaushik

Patch

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