brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · becf293 Raw
123 lines · plain
1; Test the Test Data Class instruction logic operation conversion from2; compares, combined with signbit or other compares to ensure worthiness.3;4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s5;6 7declare float @llvm.fabs.f32(float)8declare double @llvm.fabs.f64(double)9declare fp128 @llvm.fabs.f128(fp128)10 11; Compare with 0, extract sign bit12define i32 @f0(half %x) {13; CHECK-LABEL: f014; CHECK:       lgdr %r0, %f015; CHECK-NEXT:  srlg %r0, %r0, 4816; CHECK-NEXT:  lhr %r0, %r017; CHECK-NEXT:  chi %r0, 018; CHECK-NEXT:  ipm %r019; CHECK-NEXT:  risbg %r13, %r0, 63, 191, 3620; CHECK-NEXT:     # kill: def $f0h killed $f0h killed $f0d21; CHECK-NEXT:  brasl %r14, __extendhfsf2@PLT22; CHECK-NEXT:  ltebr %f0, %f023; CHECK-NEXT:  ipm %r024; CHECK-NEXT:  rosbg %r13, %r0, 63, 63, 3525; CHECK-NEXT:  lr %r2, %r1326; CHECK-NEXT:  lmg %r13, %r15, 264(%r15)27; CHECK-NEXT:  br %r1428  %cast = bitcast half %x to i1629  %sign = icmp slt i16 %cast, 030  %fcmp = fcmp ugt half %x, 0.031  %res = or i1 %sign, %fcmp32  %xres = zext i1 %res to i3233  ret i32 %xres34}35 36; Compare with 0, extract sign bit37define i32 @f1(float %x) {38; CHECK-LABEL: f139; CHECK: tceb %f0, 204740  %cast = bitcast float %x to i3241  %sign = icmp slt i32 %cast, 042  %fcmp = fcmp ugt float %x, 0.043  %res = or i1 %sign, %fcmp44  %xres = zext i1 %res to i3245  ret i32 %xres46}47 48; Compare with inf, extract negated sign bit49define i32 @f2(float %x) {50; CHECK-LABEL: f251; CHECK: tceb %f0, 269852  %cast = bitcast float %x to i3253  %sign = icmp sgt i32 %cast, -154  %fcmp = fcmp ult float %x, 0x7ff000000000000055  %res = and i1 %sign, %fcmp56  %xres = zext i1 %res to i3257  ret i32 %xres58}59 60; Compare with minnorm, extract negated sign bit61define i32 @f3(float %x) {62; CHECK-LABEL: f363; CHECK: tceb %f0, 217664  %cast = bitcast float %x to i3265  %sign = icmp sgt i32 %cast, -166  %fcmp = fcmp olt float %x, 0x381000000000000067  %res = and i1 %sign, %fcmp68  %xres = zext i1 %res to i3269  ret i32 %xres70}71 72; Test float isnormal, from clang.73define i32 @f4(float %x) {74; CHECK-LABEL: f475; CHECK: tceb %f0, 76876  %y = call float @llvm.fabs.f32(float %x)77  %ord = fcmp ord float %x, 0.078  %a = fcmp ult float %y, 0x7ff000000000000079  %b = fcmp uge float %y, 0x381000000000000080  %c = and i1 %a, %b81  %res = and i1 %ord, %c82  %xres = zext i1 %res to i3283  ret i32 %xres84}85 86; Check for negative 0.87define i32 @f5(float %x) {88; CHECK-LABEL: f589; CHECK: tceb %f0, 102490  %cast = bitcast float %x to i3291  %sign = icmp slt i32 %cast, 092  %fcmp = fcmp oeq float %x, 0.093  %res = and i1 %sign, %fcmp94  %xres = zext i1 %res to i3295  ret i32 %xres96}97 98; Test isnormal, from clang.99define i32 @f6(double %x) {100; CHECK-LABEL: f6101; CHECK: tcdb %f0, 768102  %y = call double @llvm.fabs.f64(double %x)103  %ord = fcmp ord double %x, 0.0104  %a = fcmp ult double %y, 0x7ff0000000000000105  %b = fcmp uge double %y, 0x0010000000000000106  %c = and i1 %ord, %a107  %res = and i1 %b, %c108  %xres = zext i1 %res to i32109  ret i32 %xres110}111 112; Test isinf || isnan, from clang.113define i32 @f7(double %x) {114; CHECK-LABEL: f7115; CHECK: tcdb %f0, 63116  %y = call double @llvm.fabs.f64(double %x)117  %a = fcmp oeq double %y, 0x7ff0000000000000118  %b = fcmp uno double %x, 0.0119  %res = or i1 %a, %b120  %xres = zext i1 %res to i32121  ret i32 %xres122}123