1 ; Test 64-bit unsigned comparisons in which the second operand is constant. 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5 ; Check a value near the low end of the range. We use signed forms for 6 ; comparisons with zero, or things that are equivalent to them. 7 define double @f1(double %a, double %b, i64 %i1) { 8 ; CHECK-LABEL: f1: 9 ; CHECK: clgijh %r2, 1 10 ; CHECK: ldr %f0, %f2 11 ; CHECK: br %r14 12 %cond = icmp ugt i64 %i1, 1 13 %tmp = select i1 %cond, double %a, double %b 14 %res = fadd double %tmp, 1.0 15 ret double %res 16 } 17 18 ; Check the top of the CLGIJ range. 19 define double @f2(double %a, double %b, i64 %i1) { 20 ; CHECK-LABEL: f2: 21 ; CHECK: clgijl %r2, 255 22 ; CHECK: ldr %f0, %f2 23 ; CHECK: br %r14 24 %cond = icmp ult i64 %i1, 255 25 %tmp = select i1 %cond, double %a, double %b 26 %res = fadd double %tmp, 1.0 27 ret double %res 28 } 29 30 ; Check the next value up, which needs a separate comparison. 31 define double @f3(double %a, double %b, i64 %i1) { 32 ; CHECK-LABEL: f3: 33 ; CHECK: clgfi %r2, 256 34 ; CHECK: jl 35 ; CHECK: ldr %f0, %f2 36 ; CHECK: br %r14 37 %cond = icmp ult i64 %i1, 256 38 %tmp = select i1 %cond, double %a, double %b 39 %res = fadd double %tmp, 1.0 40 ret double %res 41 } 42 43 ; Check the high end of the CLGFI range. 44 define double @f4(double %a, double %b, i64 %i1) { 45 ; CHECK-LABEL: f4: 46 ; CHECK: clgfi %r2, 4294967295 47 ; CHECK-NEXT: jl 48 ; CHECK: ldr %f0, %f2 49 ; CHECK: br %r14 50 %cond = icmp ult i64 %i1, 4294967295 51 %tmp = select i1 %cond, double %a, double %b 52 %res = fadd double %tmp, 1.0 53 ret double %res 54 } 55 56 ; Check the next value up, which can use a shifted comparison 57 define double @f5(double %a, double %b, i64 %i1) { 58 ; CHECK-LABEL: f5: 59 ; CHECK: srlg [[REG:%r[0-5]]], %r2, 32 60 ; CHECK: cgije [[REG]], 0 61 ; CHECK: ldr %f0, %f2 62 ; CHECK: br %r14 63 %cond = icmp ult i64 %i1, 4294967296 64 %tmp = select i1 %cond, double %a, double %b 65 %res = fadd double %tmp, 1.0 66 ret double %res 67 } 68 ; Check the next value up, which must use a register comparison. 69 define double @f6(double %a, double %b, i64 %i1) { 70 ; CHECK-LABEL: f6: 71 ; CHECK: clgrjl %r2, 72 ; CHECK: ldr %f0, %f2 73 ; CHECK: br %r14 74 %cond = icmp ult i64 %i1, 4294967297 75 %tmp = select i1 %cond, double %a, double %b 76 %res = fadd double %tmp, 1.0 77 ret double %res 78 } 79