This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] s390: support for movstr
- From: Adrian Straetling <straetling at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: uweigand at de dot ibm dot com, krebbel1 at de dot ibm dot com
- Date: Thu, 25 Aug 2005 13:18:10 +0200
- Subject: [patch] s390: support for movstr
Hi,
this patch adds support for 'movstr' in s390(x).
The pattern is used for strcpy at the moment. Together with the strcat
patch, it will be available for strcat, too.
Bootstrapped and regtested for s390x and s390.
It was already reviewed and approved offline by Uli.
Bye,
Adrian
2005-08-25 Adrian Straetling <straetling@de.ibm.com>
* config/s390/s390.md: ("movstr", "*movstr"): Add patterns.
(UNSPEC_MVST): New constant.
Index: gcc/config/s390/s390.md
===================================================================
*** gcc/config/s390/s390.md.orig 2005-08-24 09:34:50.973160285 +0200
--- gcc/config/s390/s390.md 2005-08-24 09:41:00.743160285 +0200
***************
*** 130,135 ****
--- 130,136 ----
; String Functions
(UNSPEC_SRST 600)
+ (UNSPEC_MVST 601)
; Stack Smashing Protector
(UNSPEC_SP_SET 700)
***************
*** 1944,1949 ****
--- 1945,1992 ----
(set_attr "type" "vs")])
;
+ ; movstr instruction pattern.
+ ;
+
+ (define_expand "movstr"
+ [(set (reg:SI 0) (const_int 0))
+ (parallel
+ [(clobber (match_dup 3))
+ (set (match_operand:BLK 1 "memory_operand" "")
+ (match_operand:BLK 2 "memory_operand" ""))
+ (set (match_operand 0 "register_operand" "")
+ (unspec [(match_dup 1)
+ (match_dup 2)
+ (reg:SI 0)] UNSPEC_MVST))
+ (clobber (reg:CC CC_REGNUM))])]
+ ""
+ {
+ rtx addr1 = gen_reg_rtx (Pmode);
+ rtx addr2 = gen_reg_rtx (Pmode);
+
+ emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
+ emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
+ operands[1] = replace_equiv_address_nv (operands[1], addr1);
+ operands[2] = replace_equiv_address_nv (operands[2], addr2);
+ operands[3] = addr2;
+ })
+
+ (define_insn "*movstr"
+ [(clobber (match_operand:P 2 "register_operand" "=d"))
+ (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
+ (mem:BLK (match_operand:P 3 "register_operand" "2")))
+ (set (match_operand:P 0 "register_operand" "=d")
+ (unspec [(mem:BLK (match_dup 1))
+ (mem:BLK (match_dup 3))
+ (reg:SI 0)] UNSPEC_MVST))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "mvst\t%1,%2\;jo\t.-4"
+ [(set_attr "length" "8")
+ (set_attr "type" "vs")])
+
+
+ ;
; movmemM instruction pattern(s).
;