xref: /llvm-project/llvm/test/CodeGen/SystemZ/strcpy-nobuiltin.ll (revision a1710eb3cd5823c5d14899112ca3086acbdbe9cb)
1; Test that strcmp won't be converted to MVST if calls are
2; marked with nobuiltin, eg. for sanitizers.
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5
6declare ptr@strcpy(ptr %dest, ptr %src)
7declare ptr@stpcpy(ptr %dest, ptr %src)
8
9; Check strcpy.
10define ptr@f1(ptr %dest, ptr %src) {
11; CHECK-LABEL: f1:
12; CHECK-NOT: mvst
13; CHECK: brasl %r14, strcpy
14; CHECK: br %r14
15  %res = call ptr@strcpy(ptr %dest, ptr %src) nobuiltin
16  ret ptr %res
17}
18
19; Check stpcpy.
20define ptr@f2(ptr %dest, ptr %src) {
21; CHECK-LABEL: f2:
22; CHECK-NOT: mvst
23; CHECK: brasl %r14, stpcpy
24; CHECK: br %r14
25  %res = call ptr@stpcpy(ptr %dest, ptr %src) nobuiltin
26  ret ptr %res
27}
28
29; Check correct operation with other loads and stores.  The load must
30; come before the loop and the store afterwards.
31define i32 @f3(i32 %dummy, ptr %dest, ptr %src, ptr %resptr, ptr %storeptr) {
32; CHECK-LABEL: f3:
33; CHECK-DAG: l [[REG1:%r[0-9]+]], 0(%r5)
34; CHECK-NOT: mvst
35; CHECK: brasl %r14, strcpy
36; CHECK: mvhi 0(%r6), 0
37; CHECK: br %r14
38  %res = load i32, ptr %resptr
39  %unused = call ptr@strcpy(ptr %dest, ptr %src) nobuiltin
40  store i32 0, ptr %storeptr
41  ret i32 %res
42}
43