1; Test strcmp using CLST, i64 version. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5declare i64 @strcmp(i8 *%src1, i8 *%src2) 6 7; Check a case where the result is used as an integer. 8define i64 @f1(i8 *%src1, i8 *%src2) { 9; CHECK-LABEL: f1: 10; CHECK: lhi %r0, 0 11; CHECK: [[LABEL:\.[^:]*]]: 12; CHECK: clst %r2, %r3 13; CHECK-NEXT: jo [[LABEL]] 14; CHECK-NEXT: BB#{{[0-9]+}} 15; CHECK-NEXT: ipm [[REG:%r[0-5]]] 16; CHECK: srl [[REG]], 28 17; CHECK: rll [[REG]], [[REG]], 31 18; CHECK: lgfr %r2, [[REG]] 19; CHECK: br %r14 20 %res = call i64 @strcmp(i8 *%src1, i8 *%src2) 21 ret i64 %res 22} 23 24; Check a case where the result is tested for equality. 25define void @f2(i8 *%src1, i8 *%src2, i64 *%dest) { 26; CHECK-LABEL: f2: 27; CHECK: lhi %r0, 0 28; CHECK: [[LABEL:\.[^:]*]]: 29; CHECK: clst %r2, %r3 30; CHECK-NEXT: jo [[LABEL]] 31; CHECK-NEXT: BB#{{[0-9]+}} 32; CHECK-NEXT: ber %r14 33; CHECK: br %r14 34 %res = call i64 @strcmp(i8 *%src1, i8 *%src2) 35 %cmp = icmp eq i64 %res, 0 36 br i1 %cmp, label %exit, label %store 37 38store: 39 store i64 0, i64 *%dest 40 br label %exit 41 42exit: 43 ret void 44} 45 46; Test a case where the result is used both as an integer and for 47; branching. 48define i64 @f3(i8 *%src1, i8 *%src2, i64 *%dest) { 49; CHECK-LABEL: f3: 50; CHECK: lhi %r0, 0 51; CHECK: [[LABEL:\.[^:]*]]: 52; CHECK: clst %r2, %r3 53; CHECK-NEXT: jo [[LABEL]] 54; CHECK-NEXT: BB#{{[0-9]+}} 55; CHECK-NEXT: ipm [[REG:%r[0-5]]] 56; CHECK: srl [[REG]], 28 57; CHECK: rll [[REG]], [[REG]], 31 58; CHECK: lgfr %r2, [[REG]] 59; CHECK: blr %r14 60; CHECK: br %r14 61entry: 62 %res = call i64 @strcmp(i8 *%src1, i8 *%src2) 63 %cmp = icmp slt i64 %res, 0 64 br i1 %cmp, label %exit, label %store 65 66store: 67 store i64 0, i64 *%dest 68 br label %exit 69 70exit: 71 ret i64 %res 72} 73