206 lines · plain
1; Test 64-bit inequality 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: cgijlh %r2, 09; CHECK: ldr %f0, %f210; CHECK: br %r1411 %cond = icmp ne i64 %i1, 012 %tmp = select i1 %cond, double %a, double %b13 %res = fadd double %tmp, 1.014 ret double %res15}16 17; Check the high end of the CGIJ range.18define double @f2(double %a, double %b, i64 %i1) {19; CHECK-LABEL: f2:20; CHECK: cgijlh %r2, 12721; CHECK: ldr %f0, %f222; CHECK: br %r1423 %cond = icmp ne i64 %i1, 12724 %tmp = select i1 %cond, double %a, double %b25 %res = fadd double %tmp, 1.026 ret double %res27}28 29; Check the next value up, which must use CGHI instead.30define double @f3(double %a, double %b, i64 %i1) {31; CHECK-LABEL: f3:32; CHECK: cghi %r2, 12833; CHECK-NEXT: jlh34; CHECK: ldr %f0, %f235; CHECK: br %r1436 %cond = icmp ne i64 %i1, 12837 %tmp = select i1 %cond, double %a, double %b38 %res = fadd double %tmp, 1.039 ret double %res40}41 42; Check the high end of the CGHI range.43define double @f4(double %a, double %b, i64 %i1) {44; CHECK-LABEL: f4:45; CHECK: cghi %r2, 3276746; CHECK-NEXT: jlh47; CHECK: ldr %f0, %f248; CHECK: br %r1449 %cond = icmp ne i64 %i1, 3276750 %tmp = select i1 %cond, double %a, double %b51 %res = fadd double %tmp, 1.052 ret double %res53}54 55; Check the next value up, which must use CGFI.56define double @f5(double %a, double %b, i64 %i1) {57; CHECK-LABEL: f5:58; CHECK: cgfi %r2, 3276859; CHECK-NEXT: jlh60; CHECK: ldr %f0, %f261; CHECK: br %r1462 %cond = icmp ne i64 %i1, 3276863 %tmp = select i1 %cond, double %a, double %b64 %res = fadd double %tmp, 1.065 ret double %res66}67 68; Check the high end of the CGFI range.69define double @f6(double %a, double %b, i64 %i1) {70; CHECK-LABEL: f6:71; CHECK: cgfi %r2, 214748364772; CHECK-NEXT: jlh73; CHECK: ldr %f0, %f274; CHECK: br %r1475 %cond = icmp ne i64 %i1, 214748364776 %tmp = select i1 %cond, double %a, double %b77 %res = fadd double %tmp, 1.078 ret double %res79}80 81; Check the next value up, which should use CLGFI instead.82define double @f7(double %a, double %b, i64 %i1) {83; CHECK-LABEL: f7:84; CHECK: clgfi %r2, 214748364885; CHECK-NEXT: jlh86; CHECK: ldr %f0, %f287; CHECK: br %r1488 %cond = icmp ne i64 %i1, 214748364889 %tmp = select i1 %cond, double %a, double %b90 %res = fadd double %tmp, 1.091 ret double %res92}93 94; Check the high end of the CLGFI range.95define double @f8(double %a, double %b, i64 %i1) {96; CHECK-LABEL: f8:97; CHECK: clgfi %r2, 429496729598; CHECK-NEXT: jlh99; CHECK: ldr %f0, %f2100; CHECK: br %r14101 %cond = icmp ne i64 %i1, 4294967295102 %tmp = select i1 %cond, double %a, double %b103 %res = fadd double %tmp, 1.0104 ret double %res105}106 107; Check the next value up, which must use a register comparison.108define double @f9(double %a, double %b, i64 %i1) {109; CHECK-LABEL: f9:110; CHECK: cgrjlh %r2,111; CHECK: ldr %f0, %f2112; CHECK: br %r14113 %cond = icmp ne i64 %i1, 4294967296114 %tmp = select i1 %cond, double %a, double %b115 %res = fadd double %tmp, 1.0116 ret double %res117}118 119; Check the high end of the negative CGIJ range.120define double @f10(double %a, double %b, i64 %i1) {121; CHECK-LABEL: f10:122; CHECK: cgijlh %r2, -1123; CHECK: ldr %f0, %f2124; CHECK: br %r14125 %cond = icmp ne i64 %i1, -1126 %tmp = select i1 %cond, double %a, double %b127 %res = fadd double %tmp, 1.0128 ret double %res129}130 131; Check the low end of the CGIJ range.132define double @f11(double %a, double %b, i64 %i1) {133; CHECK-LABEL: f11:134; CHECK: cgijlh %r2, -128135; CHECK: ldr %f0, %f2136; CHECK: br %r14137 %cond = icmp ne i64 %i1, -128138 %tmp = select i1 %cond, double %a, double %b139 %res = fadd double %tmp, 1.0140 ret double %res141}142 143; Check the next value down, which must use CGHI instead.144define double @f12(double %a, double %b, i64 %i1) {145; CHECK-LABEL: f12:146; CHECK: cghi %r2, -129147; CHECK-NEXT: jlh148; CHECK: ldr %f0, %f2149; CHECK: br %r14150 %cond = icmp ne i64 %i1, -129151 %tmp = select i1 %cond, double %a, double %b152 %res = fadd double %tmp, 1.0153 ret double %res154}155 156; Check the low end of the CGHI range.157define double @f13(double %a, double %b, i64 %i1) {158; CHECK-LABEL: f13:159; CHECK: cghi %r2, -32768160; CHECK-NEXT: jlh161; CHECK: ldr %f0, %f2162; CHECK: br %r14163 %cond = icmp ne i64 %i1, -32768164 %tmp = select i1 %cond, double %a, double %b165 %res = fadd double %tmp, 1.0166 ret double %res167}168 169; Check the next value down, which must use CGFI instead.170define double @f14(double %a, double %b, i64 %i1) {171; CHECK-LABEL: f14:172; CHECK: cgfi %r2, -32769173; CHECK-NEXT: jlh174; CHECK: ldr %f0, %f2175; CHECK: br %r14176 %cond = icmp ne i64 %i1, -32769177 %tmp = select i1 %cond, double %a, double %b178 %res = fadd double %tmp, 1.0179 ret double %res180}181 182; Check the low end of the CGFI range.183define double @f15(double %a, double %b, i64 %i1) {184; CHECK-LABEL: f15:185; CHECK: cgfi %r2, -2147483648186; CHECK-NEXT: jlh187; CHECK: ldr %f0, %f2188; CHECK: br %r14189 %cond = icmp ne i64 %i1, -2147483648190 %tmp = select i1 %cond, double %a, double %b191 %res = fadd double %tmp, 1.0192 ret double %res193}194 195; Check the next value down, which must use register comparison.196define double @f16(double %a, double %b, i64 %i1) {197; CHECK-LABEL: f16:198; CHECK: cgrjlh199; CHECK: ldr %f0, %f2200; CHECK: br %r14201 %cond = icmp ne i64 %i1, -2147483649202 %tmp = select i1 %cond, double %a, double %b203 %res = fadd double %tmp, 1.0204 ret double %res205}206