Richard Sandiford | 35b9be2 | 2013-08-28 10:31:43 +0000 | [diff] [blame^] | 1 | ; Test the use of TEST UNDER MASK for 64-bit operations. |
| 2 | ; |
| 3 | ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s |
| 4 | |
| 5 | @g = global i32 0 |
| 6 | |
| 7 | ; Check the lowest useful TMLL value. |
| 8 | define void @f1(i64 %a) { |
| 9 | ; CHECK-LABEL: f1: |
| 10 | ; CHECK: tmll %r2, 1 |
| 11 | ; CHECK: je {{\.L.*}} |
| 12 | ; CHECK: br %r14 |
| 13 | entry: |
| 14 | %and = and i64 %a, 1 |
| 15 | %cmp = icmp eq i64 %and, 0 |
| 16 | br i1 %cmp, label %exit, label %store |
| 17 | |
| 18 | store: |
| 19 | store i32 1, i32 *@g |
| 20 | br label %exit |
| 21 | |
| 22 | exit: |
| 23 | ret void |
| 24 | } |
| 25 | |
| 26 | ; Check the high end of the TMLL range. |
| 27 | define void @f2(i64 %a) { |
| 28 | ; CHECK-LABEL: f2: |
| 29 | ; CHECK: tmll %r2, 65535 |
| 30 | ; CHECK: jne {{\.L.*}} |
| 31 | ; CHECK: br %r14 |
| 32 | entry: |
| 33 | %and = and i64 %a, 65535 |
| 34 | %cmp = icmp ne i64 %and, 0 |
| 35 | br i1 %cmp, label %exit, label %store |
| 36 | |
| 37 | store: |
| 38 | store i32 1, i32 *@g |
| 39 | br label %exit |
| 40 | |
| 41 | exit: |
| 42 | ret void |
| 43 | } |
| 44 | |
| 45 | ; Check the lowest useful TMLH value, which is the next value up. |
| 46 | define void @f3(i64 %a) { |
| 47 | ; CHECK-LABEL: f3: |
| 48 | ; CHECK: tmlh %r2, 1 |
| 49 | ; CHECK: jne {{\.L.*}} |
| 50 | ; CHECK: br %r14 |
| 51 | entry: |
| 52 | %and = and i64 %a, 65536 |
| 53 | %cmp = icmp ne i64 %and, 0 |
| 54 | br i1 %cmp, label %exit, label %store |
| 55 | |
| 56 | store: |
| 57 | store i32 1, i32 *@g |
| 58 | br label %exit |
| 59 | |
| 60 | exit: |
| 61 | ret void |
| 62 | } |
| 63 | |
| 64 | ; Check the next value up again, which cannot use TM. |
| 65 | define void @f4(i64 %a) { |
| 66 | ; CHECK-LABEL: f4: |
| 67 | ; CHECK-NOT: {{tm[lh].}} |
| 68 | ; CHECK: br %r14 |
| 69 | entry: |
| 70 | %and = and i64 %a, 4294901759 |
| 71 | %cmp = icmp eq i64 %and, 0 |
| 72 | br i1 %cmp, label %exit, label %store |
| 73 | |
| 74 | store: |
| 75 | store i32 1, i32 *@g |
| 76 | br label %exit |
| 77 | |
| 78 | exit: |
| 79 | ret void |
| 80 | } |
| 81 | |
| 82 | ; Check the high end of the TMLH range. |
| 83 | define void @f5(i64 %a) { |
| 84 | ; CHECK-LABEL: f5: |
| 85 | ; CHECK: tmlh %r2, 65535 |
| 86 | ; CHECK: je {{\.L.*}} |
| 87 | ; CHECK: br %r14 |
| 88 | entry: |
| 89 | %and = and i64 %a, 4294901760 |
| 90 | %cmp = icmp eq i64 %and, 0 |
| 91 | br i1 %cmp, label %exit, label %store |
| 92 | |
| 93 | store: |
| 94 | store i32 1, i32 *@g |
| 95 | br label %exit |
| 96 | |
| 97 | exit: |
| 98 | ret void |
| 99 | } |
| 100 | |
| 101 | ; Check the lowest useful TMHL value. |
| 102 | define void @f6(i64 %a) { |
| 103 | ; CHECK-LABEL: f6: |
| 104 | ; CHECK: tmhl %r2, 1 |
| 105 | ; CHECK: je {{\.L.*}} |
| 106 | ; CHECK: br %r14 |
| 107 | entry: |
| 108 | %and = and i64 %a, 4294967296 |
| 109 | %cmp = icmp eq i64 %and, 0 |
| 110 | br i1 %cmp, label %exit, label %store |
| 111 | |
| 112 | store: |
| 113 | store i32 1, i32 *@g |
| 114 | br label %exit |
| 115 | |
| 116 | exit: |
| 117 | ret void |
| 118 | } |
| 119 | |
| 120 | ; Check the next value up again, which cannot use TM. |
| 121 | define void @f7(i64 %a) { |
| 122 | ; CHECK-LABEL: f7: |
| 123 | ; CHECK-NOT: {{tm[lh].}} |
| 124 | ; CHECK: br %r14 |
| 125 | entry: |
| 126 | %and = and i64 %a, 4294967297 |
| 127 | %cmp = icmp ne i64 %and, 0 |
| 128 | br i1 %cmp, label %exit, label %store |
| 129 | |
| 130 | store: |
| 131 | store i32 1, i32 *@g |
| 132 | br label %exit |
| 133 | |
| 134 | exit: |
| 135 | ret void |
| 136 | } |
| 137 | |
| 138 | ; Check the high end of the TMHL range. |
| 139 | define void @f8(i64 %a) { |
| 140 | ; CHECK-LABEL: f8: |
| 141 | ; CHECK: tmhl %r2, 65535 |
| 142 | ; CHECK: jne {{\.L.*}} |
| 143 | ; CHECK: br %r14 |
| 144 | entry: |
| 145 | %and = and i64 %a, 281470681743360 |
| 146 | %cmp = icmp ne i64 %and, 0 |
| 147 | br i1 %cmp, label %exit, label %store |
| 148 | |
| 149 | store: |
| 150 | store i32 1, i32 *@g |
| 151 | br label %exit |
| 152 | |
| 153 | exit: |
| 154 | ret void |
| 155 | } |
| 156 | |
| 157 | ; Check the lowest useful TMHH value. |
| 158 | define void @f9(i64 %a) { |
| 159 | ; CHECK-LABEL: f9: |
| 160 | ; CHECK: tmhh %r2, 1 |
| 161 | ; CHECK: jne {{\.L.*}} |
| 162 | ; CHECK: br %r14 |
| 163 | entry: |
| 164 | %and = and i64 %a, 281474976710656 |
| 165 | %cmp = icmp ne i64 %and, 0 |
| 166 | br i1 %cmp, label %exit, label %store |
| 167 | |
| 168 | store: |
| 169 | store i32 1, i32 *@g |
| 170 | br label %exit |
| 171 | |
| 172 | exit: |
| 173 | ret void |
| 174 | } |
| 175 | |
| 176 | ; Check the high end of the TMHH range. |
| 177 | define void @f10(i64 %a) { |
| 178 | ; CHECK-LABEL: f10: |
| 179 | ; CHECK: tmhh %r2, 65535 |
| 180 | ; CHECK: je {{\.L.*}} |
| 181 | ; CHECK: br %r14 |
| 182 | entry: |
| 183 | %and = and i64 %a, 18446462598732840960 |
| 184 | %cmp = icmp eq i64 %and, 0 |
| 185 | br i1 %cmp, label %exit, label %store |
| 186 | |
| 187 | store: |
| 188 | store i32 1, i32 *@g |
| 189 | br label %exit |
| 190 | |
| 191 | exit: |
| 192 | ret void |
| 193 | } |