79 lines · plain
1; Test 64-bit unsigned comparisons in which the second operand is constant.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s4 5; Check a value near the low end of the range. We use signed forms for6; comparisons with zero, or things that are equivalent to them.7define double @f1(double %a, double %b, i64 %i1) {8; CHECK-LABEL: f1:9; CHECK: clgijh %r2, 110; CHECK: ldr %f0, %f211; CHECK: br %r1412 %cond = icmp ugt i64 %i1, 113 %tmp = select i1 %cond, double %a, double %b14 %res = fadd double %tmp, 1.015 ret double %res16}17 18; Check the top of the CLGIJ range.19define double @f2(double %a, double %b, i64 %i1) {20; CHECK-LABEL: f2:21; CHECK: clgijl %r2, 25522; CHECK: ldr %f0, %f223; CHECK: br %r1424 %cond = icmp ult i64 %i1, 25525 %tmp = select i1 %cond, double %a, double %b26 %res = fadd double %tmp, 1.027 ret double %res28}29 30; Check the next value up, which needs a separate comparison.31define double @f3(double %a, double %b, i64 %i1) {32; CHECK-LABEL: f3:33; CHECK: clgfi %r2, 25634; CHECK: jl35; CHECK: ldr %f0, %f236; CHECK: br %r1437 %cond = icmp ult i64 %i1, 25638 %tmp = select i1 %cond, double %a, double %b39 %res = fadd double %tmp, 1.040 ret double %res41}42 43; Check the high end of the CLGFI range.44define double @f4(double %a, double %b, i64 %i1) {45; CHECK-LABEL: f4:46; CHECK: clgfi %r2, 429496729547; CHECK-NEXT: jl48; CHECK: ldr %f0, %f249; CHECK: br %r1450 %cond = icmp ult i64 %i1, 429496729551 %tmp = select i1 %cond, double %a, double %b52 %res = fadd double %tmp, 1.053 ret double %res54}55 56; Check the next value up, which can use a shifted comparison57define double @f5(double %a, double %b, i64 %i1) {58; CHECK-LABEL: f5:59; CHECK: srlg [[REG:%r[0-5]]], %r2, 3260; CHECK: cgije [[REG]], 061; CHECK: ldr %f0, %f262; CHECK: br %r1463 %cond = icmp ult i64 %i1, 429496729664 %tmp = select i1 %cond, double %a, double %b65 %res = fadd double %tmp, 1.066 ret double %res67}68; Check the next value up, which must use a register comparison.69define double @f6(double %a, double %b, i64 %i1) {70; CHECK-LABEL: f6:71; CHECK: clgrjl %r2,72; CHECK: ldr %f0, %f273; CHECK: br %r1474 %cond = icmp ult i64 %i1, 429496729775 %tmp = select i1 %cond, double %a, double %b76 %res = fadd double %tmp, 1.077 ret double %res78}79