1 ; Test 64-bit unsigned comparison in which the second operand is a variable.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define double @f1(double %a, double %b, i64 %i1, i64 %i2) {
12 %cond = icmp ult i64 %i1, %i2
13 %res = select i1 %cond, double %a, double %b
17 ; Check CLG with no displacement.
18 define double @f2(double %a, double %b, i64 %i1, i64 *%ptr) {
20 ; CHECK: clg %r2, 0(%r3)
25 %cond = icmp ult i64 %i1, %i2
26 %res = select i1 %cond, double %a, double %b
30 ; Check the high end of the aligned CLG range.
31 define double @f3(double %a, double %b, i64 %i1, i64 *%base) {
33 ; CHECK: clg %r2, 524280(%r3)
37 %ptr = getelementptr i64 *%base, i64 65535
39 %cond = icmp ult i64 %i1, %i2
40 %res = select i1 %cond, double %a, double %b
44 ; Check the next doubleword up, which needs separate address logic.
45 ; Other sequences besides this one would be OK.
46 define double @f4(double %a, double %b, i64 %i1, i64 *%base) {
48 ; CHECK: agfi %r3, 524288
49 ; CHECK: clg %r2, 0(%r3)
53 %ptr = getelementptr i64 *%base, i64 65536
55 %cond = icmp ult i64 %i1, %i2
56 %res = select i1 %cond, double %a, double %b
60 ; Check the high end of the negative aligned CLG range.
61 define double @f5(double %a, double %b, i64 %i1, i64 *%base) {
63 ; CHECK: clg %r2, -8(%r3)
67 %ptr = getelementptr i64 *%base, i64 -1
69 %cond = icmp ult i64 %i1, %i2
70 %res = select i1 %cond, double %a, double %b
74 ; Check the low end of the CLG range.
75 define double @f6(double %a, double %b, i64 %i1, i64 *%base) {
77 ; CHECK: clg %r2, -524288(%r3)
81 %ptr = getelementptr i64 *%base, i64 -65536
83 %cond = icmp ult i64 %i1, %i2
84 %res = select i1 %cond, double %a, double %b
88 ; Check the next doubleword down, which needs separate address logic.
89 ; Other sequences besides this one would be OK.
90 define double @f7(double %a, double %b, i64 %i1, i64 *%base) {
92 ; CHECK: agfi %r3, -524296
93 ; CHECK: clg %r2, 0(%r3)
97 %ptr = getelementptr i64 *%base, i64 -65537
99 %cond = icmp ult i64 %i1, %i2
100 %res = select i1 %cond, double %a, double %b
104 ; Check that CLG allows an index.
105 define double @f8(double %a, double %b, i64 %i1, i64 %base, i64 %index) {
107 ; CHECK: clg %r2, 524280({{%r4,%r3|%r3,%r4}})
109 ; CHECK: ldr %f0, %f2
111 %add1 = add i64 %base, %index
112 %add2 = add i64 %add1, 524280
113 %ptr = inttoptr i64 %add2 to i64 *
115 %cond = icmp ult i64 %i1, %i2
116 %res = select i1 %cond, double %a, double %b