1 ; Test zE12 conditional traps
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=zEC12 | FileCheck %s
5 declare void @llvm.trap()
7 ; Check conditional compare logical and trap
8 define i32 @f1(i32 zeroext %a, i32 *%ptr) {
10 ; CHECK: clth %r2, 0(%r3)
14 %b = load i32, i32 *%ptr
15 %cmp = icmp ugt i32 %a, %b
16 br i1 %cmp, label %if.then, label %if.end
18 if.then: ; preds = %entry
19 tail call void @llvm.trap()
22 if.end: ; preds = %entry
26 ; Check conditional compare logical grande and trap
27 define i64 @f2(i64 zeroext %a, i64 *%ptr) {
29 ; CHECK: clgtl %r2, 0(%r3)
33 %b = load i64, i64 *%ptr
34 %cmp = icmp ult i64 %a, %b
35 br i1 %cmp, label %if.then, label %if.end
37 if.then: ; preds = %entry
38 tail call void @llvm.trap()
41 if.end: ; preds = %entry
45 ; Verify that we don't attempt to use the compare and trap
46 ; instruction with an index operand.
47 define i32 @f3(i32 zeroext %a, i32 *%base, i64 %offset) {
49 ; CHECK: cl %r2, 0(%r{{[0-5]}},%r3)
55 %ptr = getelementptr i32, i32 *%base, i64 %offset
56 %b = load i32, i32 *%ptr
57 %cmp = icmp ugt i32 %a, %b
58 br i1 %cmp, label %if.then, label %if.end
60 if.then: ; preds = %entry
61 tail call void @llvm.trap()
64 if.end: ; preds = %entry
68 ; Verify that we don't attempt to use the compare and trap grande
69 ; instruction with an index operand.
70 define i64 @f4(i64 %a, i64 *%base, i64 %offset) {
72 ; CHECK: clg %r2, 0(%r{{[0-5]}},%r3)
78 %ptr = getelementptr i64, i64 *%base, i64 %offset
79 %b = load i64, i64 *%ptr
80 %cmp = icmp ugt i64 %a, %b
81 br i1 %cmp, label %if.then, label %if.end
83 if.then: ; preds = %entry
84 tail call void @llvm.trap()
87 if.end: ; preds = %entry