Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 1 | ; Test 64-bit inequality comparisons in which the second operand is a constant. |
| 2 | ; |
| 3 | ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s |
| 4 | |
| 5 | ; Check comparisons with 0. |
| 6 | define double @f1(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 7 | ; CHECK-LABEL: f1: |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 8 | ; CHECK: cgijlh %r2, 0 |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 9 | ; CHECK: ldr %f0, %f2 |
| 10 | ; CHECK: br %r14 |
| 11 | %cond = icmp ne i64 %i1, 0 |
| 12 | %res = select i1 %cond, double %a, double %b |
| 13 | ret double %res |
| 14 | } |
| 15 | |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 16 | ; Check the high end of the CGIJ range. |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 17 | define double @f2(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 18 | ; CHECK-LABEL: f2: |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 19 | ; CHECK: cgijlh %r2, 127 |
| 20 | ; CHECK: ldr %f0, %f2 |
| 21 | ; CHECK: br %r14 |
| 22 | %cond = icmp ne i64 %i1, 127 |
| 23 | %res = select i1 %cond, double %a, double %b |
| 24 | ret double %res |
| 25 | } |
| 26 | |
| 27 | ; Check the next value up, which must use CGHI instead. |
| 28 | define double @f3(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 29 | ; CHECK-LABEL: f3: |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 30 | ; CHECK: cghi %r2, 128 |
| 31 | ; CHECK-NEXT: jlh |
| 32 | ; CHECK: ldr %f0, %f2 |
| 33 | ; CHECK: br %r14 |
| 34 | %cond = icmp ne i64 %i1, 128 |
| 35 | %res = select i1 %cond, double %a, double %b |
| 36 | ret double %res |
| 37 | } |
| 38 | |
| 39 | ; Check the high end of the CGHI range. |
| 40 | define double @f4(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 41 | ; CHECK-LABEL: f4: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 42 | ; CHECK: cghi %r2, 32767 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 43 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 44 | ; CHECK: ldr %f0, %f2 |
| 45 | ; CHECK: br %r14 |
| 46 | %cond = icmp ne i64 %i1, 32767 |
| 47 | %res = select i1 %cond, double %a, double %b |
| 48 | ret double %res |
| 49 | } |
| 50 | |
| 51 | ; Check the next value up, which must use CGFI. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 52 | define double @f5(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 53 | ; CHECK-LABEL: f5: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 54 | ; CHECK: cgfi %r2, 32768 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 55 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 56 | ; CHECK: ldr %f0, %f2 |
| 57 | ; CHECK: br %r14 |
| 58 | %cond = icmp ne i64 %i1, 32768 |
| 59 | %res = select i1 %cond, double %a, double %b |
| 60 | ret double %res |
| 61 | } |
| 62 | |
| 63 | ; Check the high end of the CGFI range. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 64 | define double @f6(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 65 | ; CHECK-LABEL: f6: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 66 | ; CHECK: cgfi %r2, 2147483647 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 67 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 68 | ; CHECK: ldr %f0, %f2 |
| 69 | ; CHECK: br %r14 |
| 70 | %cond = icmp ne i64 %i1, 2147483647 |
| 71 | %res = select i1 %cond, double %a, double %b |
| 72 | ret double %res |
| 73 | } |
| 74 | |
| 75 | ; Check the next value up, which should use CLGFI instead. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 76 | define double @f7(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 77 | ; CHECK-LABEL: f7: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 78 | ; CHECK: clgfi %r2, 2147483648 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 79 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 80 | ; CHECK: ldr %f0, %f2 |
| 81 | ; CHECK: br %r14 |
| 82 | %cond = icmp ne i64 %i1, 2147483648 |
| 83 | %res = select i1 %cond, double %a, double %b |
| 84 | ret double %res |
| 85 | } |
| 86 | |
| 87 | ; Check the high end of the CLGFI range. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 88 | define double @f8(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 89 | ; CHECK-LABEL: f8: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 90 | ; CHECK: clgfi %r2, 4294967295 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 91 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 92 | ; CHECK: ldr %f0, %f2 |
| 93 | ; CHECK: br %r14 |
| 94 | %cond = icmp ne i64 %i1, 4294967295 |
| 95 | %res = select i1 %cond, double %a, double %b |
| 96 | ret double %res |
| 97 | } |
| 98 | |
| 99 | ; Check the next value up, which must use a register comparison. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 100 | define double @f9(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 101 | ; CHECK-LABEL: f9: |
Richard Sandiford | 0fb90ab | 2013-05-28 10:41:11 +0000 | [diff] [blame] | 102 | ; CHECK: cgrjlh %r2, |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 103 | ; CHECK: ldr %f0, %f2 |
| 104 | ; CHECK: br %r14 |
| 105 | %cond = icmp ne i64 %i1, 4294967296 |
| 106 | %res = select i1 %cond, double %a, double %b |
| 107 | ret double %res |
| 108 | } |
| 109 | |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 110 | ; Check the high end of the negative CGIJ range. |
| 111 | define double @f10(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 112 | ; CHECK-LABEL: f10: |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 113 | ; CHECK: cgijlh %r2, -1 |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 114 | ; CHECK: ldr %f0, %f2 |
| 115 | ; CHECK: br %r14 |
| 116 | %cond = icmp ne i64 %i1, -1 |
| 117 | %res = select i1 %cond, double %a, double %b |
| 118 | ret double %res |
| 119 | } |
| 120 | |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 121 | ; Check the low end of the CGIJ range. |
| 122 | define double @f11(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 123 | ; CHECK-LABEL: f11: |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 124 | ; CHECK: cgijlh %r2, -128 |
| 125 | ; CHECK: ldr %f0, %f2 |
| 126 | ; CHECK: br %r14 |
| 127 | %cond = icmp ne i64 %i1, -128 |
| 128 | %res = select i1 %cond, double %a, double %b |
| 129 | ret double %res |
| 130 | } |
| 131 | |
| 132 | ; Check the next value down, which must use CGHI instead. |
| 133 | define double @f12(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 134 | ; CHECK-LABEL: f12: |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 135 | ; CHECK: cghi %r2, -129 |
| 136 | ; CHECK-NEXT: jlh |
| 137 | ; CHECK: ldr %f0, %f2 |
| 138 | ; CHECK: br %r14 |
| 139 | %cond = icmp ne i64 %i1, -129 |
| 140 | %res = select i1 %cond, double %a, double %b |
| 141 | ret double %res |
| 142 | } |
| 143 | |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 144 | ; Check the low end of the CGHI range. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 145 | define double @f13(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 146 | ; CHECK-LABEL: f13: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 147 | ; CHECK: cghi %r2, -32768 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 148 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 149 | ; CHECK: ldr %f0, %f2 |
| 150 | ; CHECK: br %r14 |
| 151 | %cond = icmp ne i64 %i1, -32768 |
| 152 | %res = select i1 %cond, double %a, double %b |
| 153 | ret double %res |
| 154 | } |
| 155 | |
| 156 | ; Check the next value down, which must use CGFI instead. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 157 | define double @f14(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 158 | ; CHECK-LABEL: f14: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 159 | ; CHECK: cgfi %r2, -32769 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 160 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 161 | ; CHECK: ldr %f0, %f2 |
| 162 | ; CHECK: br %r14 |
| 163 | %cond = icmp ne i64 %i1, -32769 |
| 164 | %res = select i1 %cond, double %a, double %b |
| 165 | ret double %res |
| 166 | } |
| 167 | |
| 168 | ; Check the low end of the CGFI range. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 169 | define double @f15(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 170 | ; CHECK-LABEL: f15: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 171 | ; CHECK: cgfi %r2, -2147483648 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 172 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 173 | ; CHECK: ldr %f0, %f2 |
| 174 | ; CHECK: br %r14 |
| 175 | %cond = icmp ne i64 %i1, -2147483648 |
| 176 | %res = select i1 %cond, double %a, double %b |
| 177 | ret double %res |
| 178 | } |
| 179 | |
| 180 | ; Check the next value down, which must use register comparison. |
Richard Sandiford | e1d9f00 | 2013-05-29 11:58:52 +0000 | [diff] [blame] | 181 | define double @f16(double %a, double %b, i64 %i1) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame^] | 182 | ; CHECK-LABEL: f16: |
Richard Sandiford | 0fb90ab | 2013-05-28 10:41:11 +0000 | [diff] [blame] | 183 | ; CHECK: cgrjlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 184 | ; CHECK: ldr %f0, %f2 |
| 185 | ; CHECK: br %r14 |
| 186 | %cond = icmp ne i64 %i1, -2147483649 |
| 187 | %res = select i1 %cond, double %a, double %b |
| 188 | ret double %res |
| 189 | } |