diff mbox

[committed,FT32] Limit MEMSET, MEMCPY to <512 bytes

Message ID CA9BBF0458F83C4F9051448B941B57D11A267D44@glaexch1
State New
Headers show

Commit Message

James Bowman Sept. 29, 2015, 11:34 p.m. UTC
The attached patch limits the MEMSET (setmemsi pattern) and MEMCPY
(movmemsi pattern) instructions to 0-511 bytes. There is a hardware
limitation on large MEMSET, MEMCPY operations that the library versions
of memset() and memcpy() deal with.

[gcc]

2015-09-29  James Bowman  <james.bowman@ftdichip.com>

	* config/ft32/predicates.md (ft32_imm_operand): New predicate.
	* config/ft32/ft32.md (movmemsi, setmemsi): Use ft32_imm_operand
	predicate, disallow register for operand 2.
diff mbox

Patch

Index: gcc/config/ft32/ft32.md
===================================================================
--- gcc/config/ft32/ft32.md	(revision 228109)
+++ gcc/config/ft32/ft32.md	(working copy)
@@ -841,19 +841,19 @@ 
 )
 
 (define_insn "movmemsi"
-  [(set (match_operand:BLK 0 "memory_operand" "=W,W,BW")
-        (match_operand:BLK 1 "memory_operand" "W,W,BW"))
-        (use (match_operand:SI 2 "ft32_rimm_operand" "r,KA,rKA"))
+  [(set (match_operand:BLK 0 "memory_operand" "=W,BW")
+        (match_operand:BLK 1 "memory_operand" "W,BW"))
+        (use (match_operand:SI 2 "ft32_imm_operand" "KA,KA"))
         (use (match_operand:SI 3))
    ]
   ""
-  "memcpy.%d3 %b0,%b1,%2 # %3!"
+  "memcpy.%d3 %b0,%b1,%2 "
 )
 
 (define_insn "setmemsi"
-  [(set (match_operand:BLK 0 "memory_operand" "=BW,BW") (unspec:BLK [
-     (use (match_operand:QI 2 "register_operand" "r,r"))
-     (use (match_operand:SI 1 "ft32_rimm_operand" "r,KA"))
+  [(set (match_operand:BLK 0 "memory_operand" "=BW") (unspec:BLK [
+     (use (match_operand:QI 2 "register_operand" "r"))
+     (use (match_operand:SI 1 "ft32_imm_operand" "KA"))
    ] UNSPEC_SETMEM))
    (use (match_operand:SI 3))
    ]
Index: gcc/config/ft32/predicates.md
===================================================================
--- gcc/config/ft32/predicates.md	(revision 228109)
+++ gcc/config/ft32/predicates.md	(working copy)
@@ -80,6 +80,10 @@ 
        (and (match_code "const_int")
             (match_test "IN_RANGE (INTVAL (op), -512, 511)"))))
 
+(define_predicate "ft32_imm_operand"
+  (and (match_code "const_int")
+       (match_test "IN_RANGE (INTVAL (op), -512, 511)")))
+
 (define_predicate "ft32_bwidth_operand"
   (and (match_code "const_int")
        (match_test "IN_RANGE (INTVAL (op), 1, 16)")))