1 ; Test 32-bit signed comparison in which the second operand is constant.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 ; Check comparisons with 0.
6 define double @f1(double %a, double %b, i32 %i1) {
12 %cond = icmp slt i32 %i1, 0
13 %res = select i1 %cond, double %a, double %b
17 ; Check comparisons with 1.
18 define double @f2(double %a, double %b, i32 %i1) {
21 ; CHECK-NEXT: j{{g?}}l
24 %cond = icmp slt i32 %i1, 1
25 %res = select i1 %cond, double %a, double %b
29 ; Check the high end of the CHI range.
30 define double @f3(double %a, double %b, i32 %i1) {
32 ; CHECK: chi %r2, 32767
33 ; CHECK-NEXT: j{{g?}}l
36 %cond = icmp slt i32 %i1, 32767
37 %res = select i1 %cond, double %a, double %b
41 ; Check the next value up, which must use CFI.
42 define double @f4(double %a, double %b, i32 %i1) {
44 ; CHECK: cfi %r2, 32768
45 ; CHECK-NEXT: j{{g?}}l
48 %cond = icmp slt i32 %i1, 32768
49 %res = select i1 %cond, double %a, double %b
53 ; Check the high end of the signed 32-bit range.
54 define double @f5(double %a, double %b, i32 %i1) {
56 ; CHECK: cfi %r2, 2147483647
57 ; CHECK-NEXT: j{{g?}}e
60 %cond = icmp eq i32 %i1, 2147483647
61 %res = select i1 %cond, double %a, double %b
65 ; Check the next value up, which should be treated as a negative value.
66 define double @f6(double %a, double %b, i32 %i1) {
68 ; CHECK: cfi %r2, -2147483648
69 ; CHECK-NEXT: j{{g?}}e
72 %cond = icmp eq i32 %i1, 2147483648
73 %res = select i1 %cond, double %a, double %b
77 ; Check the high end of the negative CHI range.
78 define double @f7(double %a, double %b, i32 %i1) {
81 ; CHECK-NEXT: j{{g?}}l
84 %cond = icmp slt i32 %i1, -1
85 %res = select i1 %cond, double %a, double %b
89 ; Check the low end of the CHI range.
90 define double @f8(double %a, double %b, i32 %i1) {
92 ; CHECK: chi %r2, -32768
93 ; CHECK-NEXT: j{{g?}}l
96 %cond = icmp slt i32 %i1, -32768
97 %res = select i1 %cond, double %a, double %b
101 ; Check the next value down, which must use CFI instead.
102 define double @f9(double %a, double %b, i32 %i1) {
104 ; CHECK: cfi %r2, -32769
105 ; CHECK-NEXT: j{{g?}}l
106 ; CHECK: ldr %f0, %f2
108 %cond = icmp slt i32 %i1, -32769
109 %res = select i1 %cond, double %a, double %b
113 ; Check the low end of the signed 32-bit range.
114 define double @f10(double %a, double %b, i32 %i1) {
116 ; CHECK: cfi %r2, -2147483648
117 ; CHECK-NEXT: j{{g?}}e
118 ; CHECK: ldr %f0, %f2
120 %cond = icmp eq i32 %i1, -2147483648
121 %res = select i1 %cond, double %a, double %b
125 ; Check the next value down, which should be treated as a positive value.
126 define double @f11(double %a, double %b, i32 %i1) {
128 ; CHECK: cfi %r2, 2147483647
129 ; CHECK-NEXT: j{{g?}}e
130 ; CHECK: ldr %f0, %f2
132 %cond = icmp eq i32 %i1, -2147483649
133 %res = select i1 %cond, double %a, double %b