1; Test all condition-code masks that are relevant for floating-point
2; comparisons.
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5
6define void @f1(float *%src, float %target) {
7; CHECK-LABEL: f1:
8; CHECK: .cfi_startproc
9; CHECK: .L[[LABEL:.*]]:
10; CHECK: ceb %f0, 0(%r2)
11; CHECK-NEXT: je .L[[LABEL]]
12  br label %loop
13loop:
14  %val = load volatile float *%src
15  %cond = fcmp oeq float %target, %val
16  br i1 %cond, label %loop, label %exit
17exit:
18  ret void
19}
20
21define void @f2(float *%src, float %target) {
22; CHECK-LABEL: f2:
23; CHECK: .cfi_startproc
24; CHECK: .L[[LABEL:.*]]:
25; CHECK: ceb %f0, 0(%r2)
26; CHECK-NEXT: jlh .L[[LABEL]]
27  br label %loop
28loop:
29  %val = load volatile float *%src
30  %cond = fcmp one float %target, %val
31  br i1 %cond, label %loop, label %exit
32exit:
33  ret void
34}
35
36define void @f3(float *%src, float %target) {
37; CHECK-LABEL: f3:
38; CHECK: .cfi_startproc
39; CHECK: .L[[LABEL:.*]]:
40; CHECK: ceb %f0, 0(%r2)
41; CHECK-NEXT: jle .L[[LABEL]]
42  br label %loop
43loop:
44  %val = load volatile float *%src
45  %cond = fcmp ole float %target, %val
46  br i1 %cond, label %loop, label %exit
47exit:
48  ret void
49}
50
51define void @f4(float *%src, float %target) {
52; CHECK-LABEL: f4:
53; CHECK: .cfi_startproc
54; CHECK: .L[[LABEL:.*]]:
55; CHECK: ceb %f0, 0(%r2)
56; CHECK-NEXT: jl .L[[LABEL]]
57  br label %loop
58loop:
59  %val = load volatile float *%src
60  %cond = fcmp olt float %target, %val
61  br i1 %cond, label %loop, label %exit
62exit:
63  ret void
64}
65
66define void @f5(float *%src, float %target) {
67; CHECK-LABEL: f5:
68; CHECK: .cfi_startproc
69; CHECK: .L[[LABEL:.*]]:
70; CHECK: ceb %f0, 0(%r2)
71; CHECK-NEXT: jh .L[[LABEL]]
72  br label %loop
73loop:
74  %val = load volatile float *%src
75  %cond = fcmp ogt float %target, %val
76  br i1 %cond, label %loop, label %exit
77exit:
78  ret void
79}
80
81define void @f6(float *%src, float %target) {
82; CHECK-LABEL: f6:
83; CHECK: .cfi_startproc
84; CHECK: .L[[LABEL:.*]]:
85; CHECK: ceb %f0, 0(%r2)
86; CHECK-NEXT: jhe .L[[LABEL]]
87  br label %loop
88loop:
89  %val = load volatile float *%src
90  %cond = fcmp oge float %target, %val
91  br i1 %cond, label %loop, label %exit
92exit:
93  ret void
94}
95
96define void @f7(float *%src, float %target) {
97; CHECK-LABEL: f7:
98; CHECK: .cfi_startproc
99; CHECK: .L[[LABEL:.*]]:
100; CHECK: ceb %f0, 0(%r2)
101; CHECK-NEXT: jnlh .L[[LABEL]]
102  br label %loop
103loop:
104  %val = load volatile float *%src
105  %cond = fcmp ueq float %target, %val
106  br i1 %cond, label %loop, label %exit
107exit:
108  ret void
109}
110
111define void @f8(float *%src, float %target) {
112; CHECK-LABEL: f8:
113; CHECK: .cfi_startproc
114; CHECK: .L[[LABEL:.*]]:
115; CHECK: ceb %f0, 0(%r2)
116; CHECK-NEXT: jne .L[[LABEL]]
117  br label %loop
118loop:
119  %val = load volatile float *%src
120  %cond = fcmp une float %target, %val
121  br i1 %cond, label %loop, label %exit
122exit:
123  ret void
124}
125
126define void @f9(float *%src, float %target) {
127; CHECK-LABEL: f9:
128; CHECK: .cfi_startproc
129; CHECK: .L[[LABEL:.*]]:
130; CHECK: ceb %f0, 0(%r2)
131; CHECK-NEXT: jnh .L[[LABEL]]
132  br label %loop
133loop:
134  %val = load volatile float *%src
135  %cond = fcmp ule float %target, %val
136  br i1 %cond, label %loop, label %exit
137exit:
138  ret void
139}
140
141define void @f10(float *%src, float %target) {
142; CHECK-LABEL: f10:
143; CHECK: .cfi_startproc
144; CHECK: .L[[LABEL:.*]]:
145; CHECK: ceb %f0, 0(%r2)
146; CHECK-NEXT: jnhe .L[[LABEL]]
147  br label %loop
148loop:
149  %val = load volatile float *%src
150  %cond = fcmp ult float %target, %val
151  br i1 %cond, label %loop, label %exit
152exit:
153  ret void
154}
155
156define void @f11(float *%src, float %target) {
157; CHECK-LABEL: f11:
158; CHECK: .cfi_startproc
159; CHECK: .L[[LABEL:.*]]:
160; CHECK: ceb %f0, 0(%r2)
161; CHECK-NEXT: jnle .L[[LABEL]]
162  br label %loop
163loop:
164  %val = load volatile float *%src
165  %cond = fcmp ugt float %target, %val
166  br i1 %cond, label %loop, label %exit
167exit:
168  ret void
169}
170
171define void @f12(float *%src, float %target) {
172; CHECK-LABEL: f12:
173; CHECK: .cfi_startproc
174; CHECK: .L[[LABEL:.*]]:
175; CHECK: ceb %f0, 0(%r2)
176; CHECK-NEXT: jnl .L[[LABEL]]
177  br label %loop
178loop:
179  %val = load volatile float *%src
180  %cond = fcmp uge float %target, %val
181  br i1 %cond, label %loop, label %exit
182exit:
183  ret void
184}
185
186; "jno" == "jump if no overflow", which corresponds to "jump if ordered"
187; rather than "jump if not ordered" after a floating-point comparison.
188define void @f13(float *%src, float %target) {
189; CHECK-LABEL: f13:
190; CHECK: .cfi_startproc
191; CHECK: .L[[LABEL:.*]]:
192; CHECK: ceb %f0, 0(%r2)
193; CHECK-NEXT: jno .L[[LABEL]]
194  br label %loop
195loop:
196  %val = load volatile float *%src
197  %cond = fcmp ord float %target, %val
198  br i1 %cond, label %loop, label %exit
199exit:
200  ret void
201}
202
203; "jo" == "jump if overflow", which corresponds to "jump if not ordered"
204; rather than "jump if ordered" after a floating-point comparison.
205define void @f14(float *%src, float %target) {
206; CHECK-LABEL: f14:
207; CHECK: .cfi_startproc
208; CHECK: .L[[LABEL:.*]]:
209; CHECK: ceb %f0, 0(%r2)
210; CHECK-NEXT: jo .L[[LABEL]]
211  br label %loop
212loop:
213  %val = load volatile float *%src
214  %cond = fcmp uno float %target, %val
215  br i1 %cond, label %loop, label %exit
216exit:
217  ret void
218}
219