xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/strlen-nobuiltin.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test that strlen/strnlen won't be converted to SRST if calls are
2*9880d681SAndroid Build Coastguard Worker; marked with nobuiltin, eg. for sanitizers.
3*9880d681SAndroid Build Coastguard Worker;
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdeclare i64 @strlen(i8 *%src)
7*9880d681SAndroid Build Coastguard Workerdeclare i64 @strnlen(i8 *%src, i64 %len)
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine i64 @f1(i32 %dummy, i8 *%src) {
10*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
11*9880d681SAndroid Build Coastguard Worker; CHECK: brasl %r14, strlen
12*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
13*9880d681SAndroid Build Coastguard Worker  %res = call i64 @strlen(i8 *%src) nobuiltin
14*9880d681SAndroid Build Coastguard Worker  ret i64 %res
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; Likewise for strnlen.
18*9880d681SAndroid Build Coastguard Workerdefine i64 @f2(i64 %len, i8 *%src) {
19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
20*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: srst
21*9880d681SAndroid Build Coastguard Worker; CHECK: brasl %r14, strnlen
22*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
23*9880d681SAndroid Build Coastguard Worker  %res = call i64 @strnlen(i8 *%src, i64 %len) nobuiltin
24*9880d681SAndroid Build Coastguard Worker  ret i64 %res
25*9880d681SAndroid Build Coastguard Worker}
26