192 lines · plain
1; Test 64-bit signed comparisons in which the second operand is a constant.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4 5; Check comparisons with 0.6define double @f1(double %a, double %b, i64 %i1) {7; CHECK-LABEL: f1:8; CHECK: cgijl %r2, 09; CHECK: ldr %f0, %f210; CHECK: br %r1411 %cond = icmp slt i64 %i1, 012 %tmp = select i1 %cond, double %a, double %b13 %res = fadd double %tmp, 1.014 ret double %res15}16 17; Check comparisons with 1.18define double @f2(double %a, double %b, i64 %i1) {19; CHECK-LABEL: f2:20; CHECK: cgijle %r2, 021; CHECK: ldr %f0, %f222; CHECK: br %r1423 %cond = icmp slt i64 %i1, 124 %tmp = select i1 %cond, double %a, double %b25 %res = fadd double %tmp, 1.026 ret double %res27}28 29; Check the high end of the CGIJ range.30define double @f3(double %a, double %b, i64 %i1) {31; CHECK-LABEL: f3:32; CHECK: cgijl %r2, 12733; CHECK: ldr %f0, %f234; CHECK: br %r1435 %cond = icmp slt i64 %i1, 12736 %tmp = select i1 %cond, double %a, double %b37 %res = fadd double %tmp, 1.038 ret double %res39}40 41; Check the next value up, which must use CGHI instead.42define double @f4(double %a, double %b, i64 %i1) {43; CHECK-LABEL: f4:44; CHECK: cghi %r2, 12845; CHECK-NEXT: jl46; CHECK: ldr %f0, %f247; CHECK: br %r1448 %cond = icmp slt i64 %i1, 12849 %tmp = select i1 %cond, double %a, double %b50 %res = fadd double %tmp, 1.051 ret double %res52}53 54; Check the high end of the CGHI range.55define double @f5(double %a, double %b, i64 %i1) {56; CHECK-LABEL: f5:57; CHECK: cghi %r2, 3276758; CHECK-NEXT: jl59; CHECK: ldr %f0, %f260; CHECK: br %r1461 %cond = icmp slt i64 %i1, 3276762 %tmp = select i1 %cond, double %a, double %b63 %res = fadd double %tmp, 1.064 ret double %res65}66 67; Check the next value up, which must use CGFI.68define double @f6(double %a, double %b, i64 %i1) {69; CHECK-LABEL: f6:70; CHECK: cgfi %r2, 3276871; CHECK-NEXT: jl72; CHECK: ldr %f0, %f273; CHECK: br %r1474 %cond = icmp slt i64 %i1, 3276875 %tmp = select i1 %cond, double %a, double %b76 %res = fadd double %tmp, 1.077 ret double %res78}79 80; Check the high end of the CGFI range.81define double @f7(double %a, double %b, i64 %i1) {82; CHECK-LABEL: f7:83; CHECK: cgfi %r2, 214748364784; CHECK-NEXT: jl85; CHECK: ldr %f0, %f286; CHECK: br %r1487 %cond = icmp slt i64 %i1, 214748364788 %tmp = select i1 %cond, double %a, double %b89 %res = fadd double %tmp, 1.090 ret double %res91}92 93; Check the next value up, which must use register comparison.94define double @f8(double %a, double %b, i64 %i1) {95; CHECK-LABEL: f8:96; CHECK: cgrjl97; CHECK: ldr %f0, %f298; CHECK: br %r1499 %cond = icmp slt i64 %i1, 2147483648100 %tmp = select i1 %cond, double %a, double %b101 %res = fadd double %tmp, 1.0102 ret double %res103}104 105; Check the high end of the negative CGIJ range.106define double @f9(double %a, double %b, i64 %i1) {107; CHECK-LABEL: f9:108; CHECK: cgijl %r2, -1109; CHECK: ldr %f0, %f2110; CHECK: br %r14111 %cond = icmp slt i64 %i1, -1112 %tmp = select i1 %cond, double %a, double %b113 %res = fadd double %tmp, 1.0114 ret double %res115}116 117; Check the low end of the CGIJ range.118define double @f10(double %a, double %b, i64 %i1) {119; CHECK-LABEL: f10:120; CHECK: cgijl %r2, -128121; CHECK: ldr %f0, %f2122; CHECK: br %r14123 %cond = icmp slt i64 %i1, -128124 %tmp = select i1 %cond, double %a, double %b125 %res = fadd double %tmp, 1.0126 ret double %res127}128 129; Check the next value down, which must use CGHI instead.130define double @f11(double %a, double %b, i64 %i1) {131; CHECK-LABEL: f11:132; CHECK: cghi %r2, -129133; CHECK-NEXT: jl134; CHECK: ldr %f0, %f2135; CHECK: br %r14136 %cond = icmp slt i64 %i1, -129137 %tmp = select i1 %cond, double %a, double %b138 %res = fadd double %tmp, 1.0139 ret double %res140}141 142; Check the low end of the CGHI range.143define double @f12(double %a, double %b, i64 %i1) {144; CHECK-LABEL: f12:145; CHECK: cghi %r2, -32768146; CHECK-NEXT: jl147; CHECK: ldr %f0, %f2148; CHECK: br %r14149 %cond = icmp slt i64 %i1, -32768150 %tmp = select i1 %cond, double %a, double %b151 %res = fadd double %tmp, 1.0152 ret double %res153}154 155; Check the next value down, which must use CGFI instead.156define double @f13(double %a, double %b, i64 %i1) {157; CHECK-LABEL: f13:158; CHECK: cgfi %r2, -32769159; CHECK-NEXT: jl160; CHECK: ldr %f0, %f2161; CHECK: br %r14162 %cond = icmp slt i64 %i1, -32769163 %tmp = select i1 %cond, double %a, double %b164 %res = fadd double %tmp, 1.0165 ret double %res166}167 168; Check the low end of the CGFI range.169define double @f14(double %a, double %b, i64 %i1) {170; CHECK-LABEL: f14:171; CHECK: cgfi %r2, -2147483648172; CHECK-NEXT: jl173; CHECK: ldr %f0, %f2174; CHECK: br %r14175 %cond = icmp slt i64 %i1, -2147483648176 %tmp = select i1 %cond, double %a, double %b177 %res = fadd double %tmp, 1.0178 ret double %res179}180 181; Check the next value down, which must use register comparison.182define double @f15(double %a, double %b, i64 %i1) {183; CHECK-LABEL: f15:184; CHECK: cgrjl185; CHECK: ldr %f0, %f2186; CHECK: br %r14187 %cond = icmp slt i64 %i1, -2147483649188 %tmp = select i1 %cond, double %a, double %b189 %res = fadd double %tmp, 1.0190 ret double %res191}192