1 ; Test that strcmp won't be converted to CLST if calls are 2 ; marked with nobuiltin, eg. for sanitizers. 3 ; 4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 5 6 declare signext i32 @strcmp(i8 *%src1, i8 *%src2) 7 8 ; Check a case where the result is used as an integer. 9 define i32 @f1(i8 *%src1, i8 *%src2) { 10 ; CHECK-LABEL: f1: 11 ; CHECK-NOT: clst 12 ; CHECK: brasl %r14, strcmp 13 ; CHECK: br %r14 14 %res = call i32 @strcmp(i8 *%src1, i8 *%src2) nobuiltin 15 ret i32 %res 16 } 17 18 ; Check a case where the result is tested for equality. 19 define void @f2(i8 *%src1, i8 *%src2, i32 *%dest) { 20 ; CHECK-LABEL: f2: 21 ; CHECK-NOT: clst 22 ; CHECK: brasl %r14, strcmp 23 ; CHECK: br %r14 24 %res = call i32 @strcmp(i8 *%src1, i8 *%src2) nobuiltin 25 %cmp = icmp eq i32 %res, 0 26 br i1 %cmp, label %exit, label %store 27 28 store: 29 store i32 0, i32 *%dest 30 br label %exit 31 32 exit: 33 ret void 34 } 35 36 ; Test a case where the result is used both as an integer and for 37 ; branching. 38 define i32 @f3(i8 *%src1, i8 *%src2, i32 *%dest) { 39 ; CHECK-LABEL: f3: 40 ; CHECK-NOT: clst 41 ; CHECK: brasl %r14, strcmp 42 ; CHECK: br %r14 43 entry: 44 %res = call i32 @strcmp(i8 *%src1, i8 *%src2) nobuiltin 45 %cmp = icmp slt i32 %res, 0 46 br i1 %cmp, label %exit, label %store 47 48 store: 49 store i32 0, i32 *%dest 50 br label %exit 51 52 exit: 53 ret i32 %res 54 } 55