1 ; Test the Test Data Class instruction logic operation conversion from
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 declare float @llvm.fabs.f32(float)
7 declare double @llvm.fabs.f64(double)
8 declare fp128 @llvm.fabs.f128(fp128)
10 ; Compare with 0 (unworthy)
11 define i32 @f1(float %x) {
14 ; CHECK: ltebr {{%f[0-9]+}}, %f0
16 %res = fcmp ugt float %x, 0.0
17 %xres = zext i1 %res to i32
21 ; Compare fabs with 0 (unworthy)
22 define i32 @f2(float %x) {
25 ; CHECK: lpebr {{%f[0-9]+}}, %f0
27 %y = call float @llvm.fabs.f32(float %x)
28 %res = fcmp ugt float %y, 0.0
29 %xres = zext i1 %res to i32
33 ; Compare with inf (unworthy)
34 define i32 @f3(float %x) {
37 ; CHECK: ceb %f0, 0(%r{{[0-9]+}})
39 %res = fcmp ult float %x, 0x7ff0000000000000
40 %xres = zext i1 %res to i32
44 ; Compare fabs with inf
45 define i32 @f4(float %x) {
47 ; CHECK: tceb %f0, 4047
48 %y = call float @llvm.fabs.f32(float %x)
49 %res = fcmp ult float %y, 0x7ff0000000000000
50 %xres = zext i1 %res to i32
54 ; Compare with minnorm (unworthy)
55 define i32 @f5(float %x) {
58 ; CHECK: ceb %f0, 0(%r{{[0-9]+}})
60 %res = fcmp ult float %x, 0x3810000000000000
61 %xres = zext i1 %res to i32
65 ; Compare fabs with minnorm
66 define i32 @f6(float %x) {
68 ; CHECK: tceb %f0, 3279
69 %y = call float @llvm.fabs.f32(float %x)
70 %res = fcmp ult float %y, 0x3810000000000000
71 %xres = zext i1 %res to i32
75 ; Compare fabs with minnorm, unsupported condition
76 define i32 @f7(float %x) {
79 ; CHECK: lpdfr [[REG:%f[0-9]+]], %f0
80 ; CHECK: ceb [[REG]], 0(%r{{[0-9]+}})
82 %y = call float @llvm.fabs.f32(float %x)
83 %res = fcmp ugt float %y, 0x3810000000000000
84 %xres = zext i1 %res to i32
88 ; Compare fabs with unsupported constant
89 define i32 @f8(float %x) {
92 ; CHECK: lpdfr [[REG:%f[0-9]+]], %f0
93 ; CHECK: ceb [[REG]], 0(%r{{[0-9]+}})
95 %y = call float @llvm.fabs.f32(float %x)
96 %res = fcmp ult float %y, 0x3ff0000000000000
97 %xres = zext i1 %res to i32
101 ; Compare fabs with minnorm - double
102 define i32 @f9(double %x) {
104 ; CHECK: tcdb %f0, 3279
105 %y = call double @llvm.fabs.f64(double %x)
106 %res = fcmp ult double %y, 0x0010000000000000
107 %xres = zext i1 %res to i32
111 ; Compare fabs with minnorm - long double
112 define i32 @f10(fp128 %x) {
114 ; CHECK: tcxb %f0, 3279
115 %y = call fp128 @llvm.fabs.f128(fp128 %x)
116 %res = fcmp ult fp128 %y, 0xL00000000000000000001000000000000
117 %xres = zext i1 %res to i32
121 ; Compare fabs for one with inf - clang's isfinite
122 define i32 @f11(double %x) {
124 ; CHECK: tcdb %f0, 4032
125 %y = call double @llvm.fabs.f64(double %x)
126 %res = fcmp one double %y, 0x7ff0000000000000
127 %xres = zext i1 %res to i32
131 ; Compare fabs for oeq with inf - clang's isinf
132 define i32 @f12(double %x) {
134 ; CHECK: tcdb %f0, 48
135 %y = call double @llvm.fabs.f64(double %x)
136 %res = fcmp oeq double %y, 0x7ff0000000000000
137 %xres = zext i1 %res to i32