1 ; Test traps and conditional traps
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare void @llvm.trap()
7 ; Check unconditional traps
13 tail call void @llvm.trap()
17 ; Check conditional compare immediate and trap
18 define i32 @f1(i32 signext %a) {
20 ; CHECK: cithe %r2, 15
24 %cmp = icmp sgt i32 %a, 14
25 br i1 %cmp, label %if.then, label %if.end
27 if.then: ; preds = %entry
28 tail call void @llvm.trap()
31 if.end: ; preds = %entry
35 ; Check conditional compare grande immediate and trap
36 define i64 @f2(i64 signext %a) {
38 ; CHECK: cgitle %r2, 14
42 %cmp = icmp slt i64 %a, 15
43 br i1 %cmp, label %if.then, label %if.end
45 if.then: ; preds = %entry
46 tail call void @llvm.trap()
49 if.end: ; preds = %entry
53 ; Check conditional compare logical immediate and trap
54 define i32 @f3(i32 zeroext %a) {
56 ; CHECK: clfithe %r2, 15
60 %cmp = icmp ugt i32 %a, 14
61 br i1 %cmp, label %if.then, label %if.end
63 if.then: ; preds = %entry
64 tail call void @llvm.trap()
67 if.end: ; preds = %entry
71 ; Check conditional compare grande logical immediate and trap
72 define i64 @f4(i64 zeroext %a) {
74 ; CHECK: clgitle %r2, 14
78 %cmp = icmp ult i64 %a, 15
79 br i1 %cmp, label %if.then, label %if.end
81 if.then: ; preds = %entry
82 tail call void @llvm.trap()
85 if.end: ; preds = %entry
89 ; Check conditional compare and trap
90 define i32 @f5(i32 signext %a, i32 signext %b) {
92 ; CHECK: crte %r2, %r3
96 %cmp = icmp eq i32 %a, %b
97 br i1 %cmp, label %if.then, label %if.end
99 if.then: ; preds = %entry
100 tail call void @llvm.trap()
103 if.end: ; preds = %entry
107 ; Check conditional compare grande and trap
108 define i64 @f6(i64 signext %a, i64 signext %b) {
110 ; CHECK: cgrtl %r2, %r3
114 %cmp = icmp slt i64 %a, %b
115 br i1 %cmp, label %if.then, label %if.end
117 if.then: ; preds = %entry
118 tail call void @llvm.trap()
121 if.end: ; preds = %entry
125 ; Check conditional compare logical and trap
126 define i32 @f7(i32 zeroext %a, i32 zeroext %b) {
128 ; CHECK: clrth %r2, %r3
132 %cmp = icmp ugt i32 %a, %b
133 br i1 %cmp, label %if.then, label %if.end
135 if.then: ; preds = %entry
136 tail call void @llvm.trap()
139 if.end: ; preds = %entry
143 ; Check conditional compare logical grande and trap
144 define i64 @f8(i64 zeroext %a, i64 zeroext %b) {
146 ; CHECK: clgrtl %r2, %r3
150 %cmp = icmp ult i64 %a, %b
151 br i1 %cmp, label %if.then, label %if.end
153 if.then: ; preds = %entry
154 tail call void @llvm.trap()
157 if.end: ; preds = %entry
161 ; Check conditional traps that don't have a valid Compare and Trap
162 define double @f9(double %a, double %b) {
164 ; CHECK: cdbr %f0, %f2
165 ; CHECK-LABEL: .Ltmp1
170 %cmp = fcmp oeq double %a, %b
171 br i1 %cmp, label %if.then, label %if.end
173 if.then: ; preds = %entry
174 tail call void @llvm.trap()
177 if.end: ; preds = %entry
178 ret double 0.000000e+00