1
; Test 32-bit signed comparison in which the second operand is a variable.
3
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5
; Check register comparison.
6
define double @f1(double %a, double %b, i32 %i1, i32 %i2) {
12
%cond = icmp slt i32 %i1, %i2
13
%res = select i1 %cond, double %a, double %b
17
; Check the low end of the C range.
18
define double @f2(double %a, double %b, i32 %i1, i32 *%ptr) {
20
; CHECK: c %r2, 0(%r3)
25
%cond = icmp slt i32 %i1, %i2
26
%res = select i1 %cond, double %a, double %b
30
; Check the high end of the aligned C range.
31
define double @f3(double %a, double %b, i32 %i1, i32 *%base) {
33
; CHECK: c %r2, 4092(%r3)
37
%ptr = getelementptr i32 *%base, i64 1023
39
%cond = icmp slt i32 %i1, %i2
40
%res = select i1 %cond, double %a, double %b
44
; Check the next word up, which should use CY instead of C.
45
define double @f4(double %a, double %b, i32 %i1, i32 *%base) {
47
; CHECK: cy %r2, 4096(%r3)
51
%ptr = getelementptr i32 *%base, i64 1024
53
%cond = icmp slt i32 %i1, %i2
54
%res = select i1 %cond, double %a, double %b
58
; Check the high end of the aligned CY range.
59
define double @f5(double %a, double %b, i32 %i1, i32 *%base) {
61
; CHECK: cy %r2, 524284(%r3)
65
%ptr = getelementptr i32 *%base, i64 131071
67
%cond = icmp slt i32 %i1, %i2
68
%res = select i1 %cond, double %a, double %b
72
; Check the next word up, which needs separate address logic.
73
; Other sequences besides this one would be OK.
74
define double @f6(double %a, double %b, i32 %i1, i32 *%base) {
76
; CHECK: agfi %r3, 524288
77
; CHECK: c %r2, 0(%r3)
81
%ptr = getelementptr i32 *%base, i64 131072
83
%cond = icmp slt i32 %i1, %i2
84
%res = select i1 %cond, double %a, double %b
88
; Check the high end of the negative aligned CY range.
89
define double @f7(double %a, double %b, i32 %i1, i32 *%base) {
91
; CHECK: cy %r2, -4(%r3)
95
%ptr = getelementptr i32 *%base, i64 -1
97
%cond = icmp slt i32 %i1, %i2
98
%res = select i1 %cond, double %a, double %b
102
; Check the low end of the CY range.
103
define double @f8(double %a, double %b, i32 %i1, i32 *%base) {
105
; CHECK: cy %r2, -524288(%r3)
107
; CHECK: ldr %f0, %f2
109
%ptr = getelementptr i32 *%base, i64 -131072
111
%cond = icmp slt i32 %i1, %i2
112
%res = select i1 %cond, double %a, double %b
116
; Check the next word down, which needs separate address logic.
117
; Other sequences besides this one would be OK.
118
define double @f9(double %a, double %b, i32 %i1, i32 *%base) {
120
; CHECK: agfi %r3, -524292
121
; CHECK: c %r2, 0(%r3)
123
; CHECK: ldr %f0, %f2
125
%ptr = getelementptr i32 *%base, i64 -131073
127
%cond = icmp slt i32 %i1, %i2
128
%res = select i1 %cond, double %a, double %b
132
; Check that C allows an index.
133
define double @f10(double %a, double %b, i32 %i1, i64 %base, i64 %index) {
135
; CHECK: c %r2, 4092({{%r4,%r3|%r3,%r4}})
137
; CHECK: ldr %f0, %f2
139
%add1 = add i64 %base, %index
140
%add2 = add i64 %add1, 4092
141
%ptr = inttoptr i64 %add2 to i32 *
143
%cond = icmp slt i32 %i1, %i2
144
%res = select i1 %cond, double %a, double %b
148
; Check that CY allows an index.
149
define double @f11(double %a, double %b, i32 %i1, i64 %base, i64 %index) {
151
; CHECK: cy %r2, 4096({{%r4,%r3|%r3,%r4}})
153
; CHECK: ldr %f0, %f2
155
%add1 = add i64 %base, %index
156
%add2 = add i64 %add1, 4096
157
%ptr = inttoptr i64 %add2 to i32 *
159
%cond = icmp slt i32 %i1, %i2
160
%res = select i1 %cond, double %a, double %b