1 ; Test strcpy using MVST.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare i8 *@strcpy(i8 *%dest, i8 *%src)
6 declare i8 *@stpcpy(i8 *%dest, i8 *%src)
9 define i8 *@f1(i8 *%dest, i8 *%src) {
11 ; CHECK-DAG: lhi %r0, 0
12 ; CHECK-DAG: lgr [[REG:%r[145]]], %r2
13 ; CHECK: [[LABEL:\.[^:]*]]:
14 ; CHECK-NEXT: mvst [[REG]], %r3
15 ; CHECK-NEXT: jo [[LABEL]]
18 %res = call i8 *@strcpy(i8 *%dest, i8 *%src)
23 define i8 *@f2(i8 *%dest, i8 *%src) {
26 ; CHECK: [[LABEL:\.[^:]*]]:
27 ; CHECK-NEXT: mvst %r2, %r3
28 ; CHECK-NEXT: jo [[LABEL]]
31 %res = call i8 *@stpcpy(i8 *%dest, i8 *%src)
35 ; Check correct operation with other loads and stores. The load must
36 ; come before the loop and the store afterwards.
37 define i32 @f3(i32 %dummy, i8 *%dest, i8 *%src, i32 *%resptr, i32 *%storeptr) {
39 ; CHECK-DAG: lhi %r0, 0
40 ; CHECK-DAG: l %r2, 0(%r5)
41 ; CHECK: [[LABEL:\.[^:]*]]:
42 ; CHECK-NEXT: mvst %r3, %r4
43 ; CHECK-NEXT: jo [[LABEL]]
44 ; CHECK: mvhi 0(%r6), 0
46 %res = load i32, i32 *%resptr
47 %unused = call i8 *@strcpy(i8 *%dest, i8 *%src)
48 store i32 0, i32 *%storeptr