This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: new mul* patterns "U" constraint in rl78


Hi DJ,

> Uses a "U" constraint. What should that constraint do?  Could you post a 
> patch to add it?

The U constraint was part of a source tree we worked on previously. I have
provided the patch for it below.
I have also set the valloc attribute for the multiplication insns to 'umul'.
Would that be the correct setting as 'macax' is used for the other SI 
multiplication insns which seem to also include accumulation?

Please let me know if OK.

Thanks & Regards,
Kaushik

2013-06-10  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>
       
	* config/rl78/constraints.md (U): New constraint.
	* config/rl78/rl78.md (mulqi3_rl78,mulhi3_rl78,mulhi3_g13): Add
	valloc attribute.

Index: gcc/config/rl78/constraints.md
===================================================================
--- gcc/config/rl78/constraints.md	(revision 199879)
+++ 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 199879)
+++ 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" "umul")]
 )
 
 (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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]