1 ; Test strcpy using MVST.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare ptr@strcpy(ptr %dest, ptr %src)
6 declare ptr@stpcpy(ptr %dest, ptr %src)
9 define ptr@f1(ptr %dest, ptr %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 ptr@strcpy(ptr %dest, ptr %src)
23 define ptr@f2(ptr %dest, ptr %src) {
26 ; CHECK: [[LABEL:\.[^:]*]]:
27 ; CHECK-NEXT: mvst %r2, %r3
28 ; CHECK-NEXT: jo [[LABEL]]
31 %res = call ptr@stpcpy(ptr %dest, ptr %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, ptr %dest, ptr %src, ptr %resptr, ptr %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, ptr %resptr
47 %unused = call ptr@strcpy(ptr %dest, ptr %src)
48 store i32 0, ptr %storeptr