1; Test strcpy using MVST. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5declare i8 *@strcpy(i8 *%dest, i8 *%src) 6declare i8 *@stpcpy(i8 *%dest, i8 *%src) 7 8; Check strcpy. 9define i8 *@f1(i8 *%dest, i8 *%src) { 10; CHECK-LABEL: f1: 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]] 16; CHECK-NOT: %r2 17; CHECK: br %r14 18 %res = call i8 *@strcpy(i8 *%dest, i8 *%src) 19 ret i8 *%res 20} 21 22; Check stpcpy. 23define i8 *@f2(i8 *%dest, i8 *%src) { 24; CHECK-LABEL: f2: 25; CHECK: lhi %r0, 0 26; CHECK: [[LABEL:\.[^:]*]]: 27; CHECK-NEXT: mvst %r2, %r3 28; CHECK-NEXT: jo [[LABEL]] 29; CHECK-NOT: %r2 30; CHECK: br %r14 31 %res = call i8 *@stpcpy(i8 *%dest, i8 *%src) 32 ret i8 *%res 33} 34 35; Check correct operation with other loads and stores. The load must 36; come before the loop and the store afterwards. 37define i32 @f3(i32 %dummy, i8 *%dest, i8 *%src, i32 *%resptr, i32 *%storeptr) { 38; CHECK-LABEL: f3: 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 45; CHECK: br %r14 46 %res = load i32 , i32 *%resptr 47 %unused = call i8 *@strcpy(i8 *%dest, i8 *%src) 48 store i32 0, i32 *%storeptr 49 ret i32 %res 50} 51