1; Test the Test Data Class instruction logic operation conversion from 2; compares. 3; 4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 5 6declare float @llvm.fabs.f32(float) 7declare double @llvm.fabs.f64(double) 8declare fp128 @llvm.fabs.f128(fp128) 9 10; Compare with 0 (unworthy) 11define i32 @f1(float %x) { 12; CHECK-LABEL: f1 13; CHECK-NOT: tceb 14; CHECK: ltebr {{%f[0-9]+}}, %f0 15; CHECK-NOT: tceb 16 %res = fcmp ugt float %x, 0.0 17 %xres = zext i1 %res to i32 18 ret i32 %xres 19} 20 21; Compare fabs with 0 (unworthy) 22define i32 @f2(float %x) { 23; CHECK-LABEL: f2 24; CHECK-NOT: tceb 25; CHECK: lpebr {{%f[0-9]+}}, %f0 26; CHECK-NOT: tceb 27 %y = call float @llvm.fabs.f32(float %x) 28 %res = fcmp ugt float %y, 0.0 29 %xres = zext i1 %res to i32 30 ret i32 %xres 31} 32 33; Compare with inf (unworthy) 34define i32 @f3(float %x) { 35; CHECK-LABEL: f3 36; CHECK-NOT: tceb 37; CHECK: ceb %f0, 0(%r{{[0-9]+}}) 38; CHECK-NOT: tceb 39 %res = fcmp ult float %x, 0x7ff0000000000000 40 %xres = zext i1 %res to i32 41 ret i32 %xres 42} 43 44; Compare fabs with inf 45define i32 @f4(float %x) { 46; CHECK-LABEL: f4 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 51 ret i32 %xres 52} 53 54; Compare with minnorm (unworthy) 55define i32 @f5(float %x) { 56; CHECK-LABEL: f5 57; CHECK-NOT: tceb 58; CHECK: ceb %f0, 0(%r{{[0-9]+}}) 59; CHECK-NOT: tceb 60 %res = fcmp ult float %x, 0x3810000000000000 61 %xres = zext i1 %res to i32 62 ret i32 %xres 63} 64 65; Compare fabs with minnorm 66define i32 @f6(float %x) { 67; CHECK-LABEL: f6 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 72 ret i32 %xres 73} 74 75; Compare fabs with minnorm, unsupported condition 76define i32 @f7(float %x) { 77; CHECK-LABEL: f7 78; CHECK-NOT: tceb 79; CHECK: lpdfr [[REG:%f[0-9]+]], %f0 80; CHECK: ceb [[REG]], 0(%r{{[0-9]+}}) 81; CHECK-NOT: tceb 82 %y = call float @llvm.fabs.f32(float %x) 83 %res = fcmp ugt float %y, 0x3810000000000000 84 %xres = zext i1 %res to i32 85 ret i32 %xres 86} 87 88; Compare fabs with unsupported constant 89define i32 @f8(float %x) { 90; CHECK-LABEL: f8 91; CHECK-NOT: tceb 92; CHECK: lpdfr [[REG:%f[0-9]+]], %f0 93; CHECK: ceb [[REG]], 0(%r{{[0-9]+}}) 94; CHECK-NOT: tceb 95 %y = call float @llvm.fabs.f32(float %x) 96 %res = fcmp ult float %y, 0x3ff0000000000000 97 %xres = zext i1 %res to i32 98 ret i32 %xres 99} 100 101; Compare fabs with minnorm - double 102define i32 @f9(double %x) { 103; CHECK-LABEL: f9 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 108 ret i32 %xres 109} 110 111; Compare fabs with minnorm - long double 112define i32 @f10(fp128 %x) { 113; CHECK-LABEL: f10 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 118 ret i32 %xres 119} 120 121; Compare fabs for one with inf - clang's isfinite 122define i32 @f11(double %x) { 123; CHECK-LABEL: f11 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 128 ret i32 %xres 129} 130 131; Compare fabs for oeq with inf - clang's isinf 132define i32 @f12(double %x) { 133; CHECK-LABEL: f12 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 138 ret i32 %xres 139} 140