1; Test 64-bit signed comparisons in which the second operand is a constant. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5; Check comparisons with 0. 6define double @f1(double %a, double %b, i64 %i1) { 7; CHECK-LABEL: f1: 8; CHECK: cgijl %r2, 0 9; CHECK: ldr %f0, %f2 10; CHECK: br %r14 11 %cond = icmp slt i64 %i1, 0 12 %res = select i1 %cond, double %a, double %b 13 ret double %res 14} 15 16; Check comparisons with 1. 17define double @f2(double %a, double %b, i64 %i1) { 18; CHECK-LABEL: f2: 19; CHECK: cgijle %r2, 0 20; CHECK: ldr %f0, %f2 21; CHECK: br %r14 22 %cond = icmp slt i64 %i1, 1 23 %res = select i1 %cond, double %a, double %b 24 ret double %res 25} 26 27; Check the high end of the CGIJ range. 28define double @f3(double %a, double %b, i64 %i1) { 29; CHECK-LABEL: f3: 30; CHECK: cgijl %r2, 127 31; CHECK: ldr %f0, %f2 32; CHECK: br %r14 33 %cond = icmp slt i64 %i1, 127 34 %res = select i1 %cond, double %a, double %b 35 ret double %res 36} 37 38; Check the next value up, which must use CGHI instead. 39define double @f4(double %a, double %b, i64 %i1) { 40; CHECK-LABEL: f4: 41; CHECK: cghi %r2, 128 42; CHECK-NEXT: jl 43; CHECK: ldr %f0, %f2 44; CHECK: br %r14 45 %cond = icmp slt i64 %i1, 128 46 %res = select i1 %cond, double %a, double %b 47 ret double %res 48} 49 50; Check the high end of the CGHI range. 51define double @f5(double %a, double %b, i64 %i1) { 52; CHECK-LABEL: f5: 53; CHECK: cghi %r2, 32767 54; CHECK-NEXT: jl 55; CHECK: ldr %f0, %f2 56; CHECK: br %r14 57 %cond = icmp slt i64 %i1, 32767 58 %res = select i1 %cond, double %a, double %b 59 ret double %res 60} 61 62; Check the next value up, which must use CGFI. 63define double @f6(double %a, double %b, i64 %i1) { 64; CHECK-LABEL: f6: 65; CHECK: cgfi %r2, 32768 66; CHECK-NEXT: jl 67; CHECK: ldr %f0, %f2 68; CHECK: br %r14 69 %cond = icmp slt i64 %i1, 32768 70 %res = select i1 %cond, double %a, double %b 71 ret double %res 72} 73 74; Check the high end of the CGFI range. 75define double @f7(double %a, double %b, i64 %i1) { 76; CHECK-LABEL: f7: 77; CHECK: cgfi %r2, 2147483647 78; CHECK-NEXT: jl 79; CHECK: ldr %f0, %f2 80; CHECK: br %r14 81 %cond = icmp slt i64 %i1, 2147483647 82 %res = select i1 %cond, double %a, double %b 83 ret double %res 84} 85 86; Check the next value up, which must use register comparison. 87define double @f8(double %a, double %b, i64 %i1) { 88; CHECK-LABEL: f8: 89; CHECK: cgrjl 90; CHECK: ldr %f0, %f2 91; CHECK: br %r14 92 %cond = icmp slt i64 %i1, 2147483648 93 %res = select i1 %cond, double %a, double %b 94 ret double %res 95} 96 97; Check the high end of the negative CGIJ range. 98define double @f9(double %a, double %b, i64 %i1) { 99; CHECK-LABEL: f9: 100; CHECK: cgijl %r2, -1 101; CHECK: ldr %f0, %f2 102; CHECK: br %r14 103 %cond = icmp slt i64 %i1, -1 104 %res = select i1 %cond, double %a, double %b 105 ret double %res 106} 107 108; Check the low end of the CGIJ range. 109define double @f10(double %a, double %b, i64 %i1) { 110; CHECK-LABEL: f10: 111; CHECK: cgijl %r2, -128 112; CHECK: ldr %f0, %f2 113; CHECK: br %r14 114 %cond = icmp slt i64 %i1, -128 115 %res = select i1 %cond, double %a, double %b 116 ret double %res 117} 118 119; Check the next value down, which must use CGHI instead. 120define double @f11(double %a, double %b, i64 %i1) { 121; CHECK-LABEL: f11: 122; CHECK: cghi %r2, -129 123; CHECK-NEXT: jl 124; CHECK: ldr %f0, %f2 125; CHECK: br %r14 126 %cond = icmp slt i64 %i1, -129 127 %res = select i1 %cond, double %a, double %b 128 ret double %res 129} 130 131; Check the low end of the CGHI range. 132define double @f12(double %a, double %b, i64 %i1) { 133; CHECK-LABEL: f12: 134; CHECK: cghi %r2, -32768 135; CHECK-NEXT: jl 136; CHECK: ldr %f0, %f2 137; CHECK: br %r14 138 %cond = icmp slt i64 %i1, -32768 139 %res = select i1 %cond, double %a, double %b 140 ret double %res 141} 142 143; Check the next value down, which must use CGFI instead. 144define double @f13(double %a, double %b, i64 %i1) { 145; CHECK-LABEL: f13: 146; CHECK: cgfi %r2, -32769 147; CHECK-NEXT: jl 148; CHECK: ldr %f0, %f2 149; CHECK: br %r14 150 %cond = icmp slt i64 %i1, -32769 151 %res = select i1 %cond, double %a, double %b 152 ret double %res 153} 154 155; Check the low end of the CGFI range. 156define double @f14(double %a, double %b, i64 %i1) { 157; CHECK-LABEL: f14: 158; CHECK: cgfi %r2, -2147483648 159; CHECK-NEXT: jl 160; CHECK: ldr %f0, %f2 161; CHECK: br %r14 162 %cond = icmp slt i64 %i1, -2147483648 163 %res = select i1 %cond, double %a, double %b 164 ret double %res 165} 166 167; Check the next value down, which must use register comparison. 168define double @f15(double %a, double %b, i64 %i1) { 169; CHECK-LABEL: f15: 170; CHECK: cgrjl 171; CHECK: ldr %f0, %f2 172; CHECK: br %r14 173 %cond = icmp slt i64 %i1, -2147483649 174 %res = select i1 %cond, double %a, double %b 175 ret double %res 176} 177