1 ; Test the Test Data Class instruction logic operation conversion from
2 ; compares, combined with signbit or other compares to ensure worthiness.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
7 declare float @llvm.fabs.f32(float)
8 declare double @llvm.fabs.f64(double)
9 declare fp128 @llvm.fabs.f128(fp128)
11 ; Compare with 0, extract sign bit
12 define i32 @f1(float %x) {
14 ; CHECK: tceb %f0, 2047
15 %cast = bitcast float %x to i32
16 %sign = icmp slt i32 %cast, 0
17 %fcmp = fcmp ugt float %x, 0.0
18 %res = or i1 %sign, %fcmp
19 %xres = zext i1 %res to i32
23 ; Compare with inf, extract negated sign bit
24 define i32 @f2(float %x) {
26 ; CHECK: tceb %f0, 2698
27 %cast = bitcast float %x to i32
28 %sign = icmp sgt i32 %cast, -1
29 %fcmp = fcmp ult float %x, 0x7ff0000000000000
30 %res = and i1 %sign, %fcmp
31 %xres = zext i1 %res to i32
35 ; Compare with minnorm, extract negated sign bit
36 define i32 @f3(float %x) {
38 ; CHECK: tceb %f0, 2176
39 %cast = bitcast float %x to i32
40 %sign = icmp sgt i32 %cast, -1
41 %fcmp = fcmp olt float %x, 0x3810000000000000
42 %res = and i1 %sign, %fcmp
43 %xres = zext i1 %res to i32
47 ; Test float isnormal, from clang.
48 define i32 @f4(float %x) {
50 ; CHECK: tceb %f0, 768
51 %y = call float @llvm.fabs.f32(float %x)
52 %ord = fcmp ord float %x, 0.0
53 %a = fcmp ult float %y, 0x7ff0000000000000
54 %b = fcmp uge float %y, 0x3810000000000000
56 %res = and i1 %ord, %c
57 %xres = zext i1 %res to i32
61 ; Check for negative 0.
62 define i32 @f5(float %x) {
64 ; CHECK: tceb %f0, 1024
65 %cast = bitcast float %x to i32
66 %sign = icmp slt i32 %cast, 0
67 %fcmp = fcmp oeq float %x, 0.0
68 %res = and i1 %sign, %fcmp
69 %xres = zext i1 %res to i32
73 ; Test isnormal, from clang.
74 define i32 @f6(double %x) {
76 ; CHECK: tcdb %f0, 768
77 %y = call double @llvm.fabs.f64(double %x)
78 %ord = fcmp ord double %x, 0.0
79 %a = fcmp ult double %y, 0x7ff0000000000000
80 %b = fcmp uge double %y, 0x0010000000000000
83 %xres = zext i1 %res to i32
87 ; Test isinf || isnan, from clang.
88 define i32 @f7(double %x) {
91 %y = call double @llvm.fabs.f64(double %x)
92 %a = fcmp oeq double %y, 0x7ff0000000000000
93 %b = fcmp uno double %x, 0.0
95 %xres = zext i1 %res to i32