Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 1 | ; Test 64-bit inequality comparisons that are really between a memory byte |
| 2 | ; and a constant. |
| 3 | ; |
| 4 | ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s |
| 5 | |
| 6 | ; Check the low end of the 8-bit unsigned range, with zero extension. |
| 7 | define double @f1(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 8 | ; CHECK-LABEL: f1: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 9 | ; CHECK: cli 0(%r2), 0 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 10 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 11 | ; CHECK: br %r14 |
| 12 | %val = load i8 *%ptr |
| 13 | %ext = zext i8 %val to i64 |
| 14 | %cond = icmp ne i64 %ext, 0 |
| 15 | %res = select i1 %cond, double %a, double %b |
| 16 | ret double %res |
| 17 | } |
| 18 | |
| 19 | ; Check the high end of the 8-bit unsigned range, with zero extension. |
| 20 | define double @f2(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 21 | ; CHECK-LABEL: f2: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 22 | ; CHECK: cli 0(%r2), 255 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 23 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 24 | ; CHECK: br %r14 |
| 25 | %val = load i8 *%ptr |
| 26 | %ext = zext i8 %val to i64 |
| 27 | %cond = icmp ne i64 %ext, 255 |
| 28 | %res = select i1 %cond, double %a, double %b |
| 29 | ret double %res |
| 30 | } |
| 31 | |
| 32 | ; Check the next value up, with zero extension. The condition is always false. |
| 33 | define double @f3(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 34 | ; CHECK-LABEL: f3: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 35 | ; CHECK-NOT: cli |
| 36 | ; CHECK: br %r14 |
| 37 | %val = load i8 *%ptr |
| 38 | %ext = zext i8 %val to i64 |
| 39 | %cond = icmp ne i64 %ext, 256 |
| 40 | %res = select i1 %cond, double %a, double %b |
| 41 | ret double %res |
| 42 | } |
| 43 | |
| 44 | ; Check comparisons with -1, with zero extension. |
| 45 | ; This condition is also always false. |
| 46 | define double @f4(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 47 | ; CHECK-LABEL: f4: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 48 | ; CHECK-NOT: cli |
| 49 | ; CHECK: br %r14 |
| 50 | %val = load i8 *%ptr |
| 51 | %ext = zext i8 %val to i64 |
| 52 | %cond = icmp ne i64 %ext, -1 |
| 53 | %res = select i1 %cond, double %a, double %b |
| 54 | ret double %res |
| 55 | } |
| 56 | |
| 57 | ; Check comparisons with 0, using sign extension. |
| 58 | define double @f5(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 59 | ; CHECK-LABEL: f5: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 60 | ; CHECK: cli 0(%r2), 0 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 61 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 62 | ; CHECK: br %r14 |
| 63 | %val = load i8 *%ptr |
| 64 | %ext = sext i8 %val to i64 |
| 65 | %cond = icmp ne i64 %ext, 0 |
| 66 | %res = select i1 %cond, double %a, double %b |
| 67 | ret double %res |
| 68 | } |
| 69 | |
| 70 | ; Check the high end of the signed 8-bit range, using sign extension. |
| 71 | define double @f6(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 72 | ; CHECK-LABEL: f6: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 73 | ; CHECK: cli 0(%r2), 127 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 74 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 75 | ; CHECK: br %r14 |
| 76 | %val = load i8 *%ptr |
| 77 | %ext = sext i8 %val to i64 |
| 78 | %cond = icmp ne i64 %ext, 127 |
| 79 | %res = select i1 %cond, double %a, double %b |
| 80 | ret double %res |
| 81 | } |
| 82 | |
| 83 | ; Check the next value up, using sign extension. |
| 84 | ; The condition is always false. |
| 85 | define double @f7(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 86 | ; CHECK-LABEL: f7: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 87 | ; CHECK-NOT: cli |
| 88 | ; CHECK: br %r14 |
| 89 | %val = load i8 *%ptr |
| 90 | %ext = sext i8 %val to i64 |
| 91 | %cond = icmp ne i64 %ext, 128 |
| 92 | %res = select i1 %cond, double %a, double %b |
| 93 | ret double %res |
| 94 | } |
| 95 | |
| 96 | ; Check comparisons with -1, using sign extension. |
| 97 | define double @f8(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 98 | ; CHECK-LABEL: f8: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 99 | ; CHECK: cli 0(%r2), 255 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 100 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 101 | ; CHECK: br %r14 |
| 102 | %val = load i8 *%ptr |
| 103 | %ext = sext i8 %val to i64 |
| 104 | %cond = icmp ne i64 %ext, -1 |
| 105 | %res = select i1 %cond, double %a, double %b |
| 106 | ret double %res |
| 107 | } |
| 108 | |
| 109 | ; Check the low end of the signed 8-bit range, using sign extension. |
| 110 | define double @f9(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 111 | ; CHECK-LABEL: f9: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 112 | ; CHECK: cli 0(%r2), 128 |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 113 | ; CHECK-NEXT: jlh |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 114 | ; CHECK: br %r14 |
| 115 | %val = load i8 *%ptr |
| 116 | %ext = sext i8 %val to i64 |
| 117 | %cond = icmp ne i64 %ext, -128 |
| 118 | %res = select i1 %cond, double %a, double %b |
| 119 | ret double %res |
| 120 | } |
| 121 | |
| 122 | ; Check the next value down, using sign extension. |
| 123 | ; The condition is always false. |
| 124 | define double @f10(double %a, double %b, i8 *%ptr) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 125 | ; CHECK-LABEL: f10: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 126 | ; CHECK-NOT: cli |
| 127 | ; CHECK: br %r14 |
| 128 | %val = load i8 *%ptr |
| 129 | %ext = sext i8 %val to i64 |
| 130 | %cond = icmp ne i64 %ext, -129 |
| 131 | %res = select i1 %cond, double %a, double %b |
| 132 | ret double %res |
| 133 | } |