1 ; Test strlen using SRST, i64 version.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare i64 @strlen(ptr %src)
6 declare i64 @strnlen(ptr %src, i64 %len)
8 ; Test strlen with its proper i64 prototype. It would also be valid for
9 ; the uses of %r3 and REG after the LGR to be swapped.
10 define i64 @f1(i32 %dummy, ptr %src) {
12 ; CHECK-DAG: lhi %r0, 0
13 ; CHECK-DAG: lghi %r2, 0
14 ; CHECK-DAG: lgr [[REG:%r[145]]], %r3
15 ; CHECK: [[LABEL:\.[^:]*]]:
16 ; CHECK-NEXT: srst %r2, [[REG]]
17 ; CHECK-NEXT: jo [[LABEL]]
18 ; CHECK-NEXT: %bb.{{[0-9]+}}
19 ; CHECK-NEXT: sgr %r2, %r3
21 %res = call i64 @strlen(ptr %src)
25 ; Test strnlen with its proper i64 prototype.
26 define i64 @f2(i64 %len, ptr %src) {
28 ; CHECK-DAG: agr %r2, %r3
29 ; CHECK-DAG: lhi %r0, 0
30 ; CHECK-DAG: lgr [[REG:%r[145]]], %r3
31 ; CHECK: [[LABEL:\.[^:]*]]:
32 ; CHECK-NEXT: srst %r2, [[REG]]
33 ; CHECK-NEXT: jo [[LABEL]]
34 ; CHECK-NEXT: %bb.{{[0-9]+}}
35 ; CHECK-NEXT: sgr %r2, %r3
37 %res = call i64 @strnlen(ptr %src, i64 %len)