1; Test the Test Data Class instruction, as used by fpclassify.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4;
5
6declare float @llvm.fabs.f32(float)
7declare double @llvm.fabs.f64(double)
8declare fp128 @llvm.fabs.f128(fp128)
9
10define i32 @fpc(double %x) {
11entry:
12; CHECK-LABEL: fpc
13; CHECK-DAG: lhi %r2, 5
14; CHECK-DAG: ltdbr %f0, %f0
15; CHECK: je [[RET:.L.*]]
16  %testeq = fcmp oeq double %x, 0.000000e+00
17  br i1 %testeq, label %ret, label %nonzero, !prof !1
18
19nonzero:
20; CHECK-DAG: lhi %r2, 1
21; CHECK-DAG: cdbr %f0, %f0
22; CHECK: jo [[RET]]
23  %testnan = fcmp uno double %x, 0.000000e+00
24  br i1 %testnan, label %ret, label %nonzeroord, !prof !1
25
26nonzeroord:
27; CHECK-DAG: lhi %r2, 2
28; CHECK-DAG: tcdb %f0, 48
29; CHECK: jl [[RET]]
30  %abs = tail call double @llvm.fabs.f64(double %x)
31  %testinf = fcmp oeq double %abs, 0x7FF0000000000000
32  br i1 %testinf, label %ret, label %finite, !prof !1
33
34finite:
35; CHECK-DAG: lhi %r2, 3
36; CHECK-DAG: tcdb %f0, 831
37; CHECK: blr %r14
38; CHECK: lhi %r2, 4
39  %testnormal = fcmp uge double %abs, 0x10000000000000
40  %finres = select i1 %testnormal, i32 3, i32 4
41  br label %ret
42
43ret:
44; CHECK: [[RET]]:
45; CHECK: br %r14
46  %res = phi i32 [ 5, %entry ], [ 1, %nonzero ], [ 2, %nonzeroord ], [ %finres, %finite ]
47  ret i32 %res
48}
49
50!1 = !{!"branch_weights", i32 1, i32 1}
51