Richard Sandiford | 35b9be2 | 2013-08-28 10:31:43 +0000 | [diff] [blame^] | 1 | ; Test the use of TEST UNDER MASK for 32-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(i32 %a) { |
| 9 | ; CHECK-LABEL: f1: |
| 10 | ; CHECK: tmll %r2, 1 |
| 11 | ; CHECK: je {{\.L.*}} |
| 12 | ; CHECK: br %r14 |
| 13 | entry: |
| 14 | %and = and i32 %a, 1 |
| 15 | %cmp = icmp eq i32 %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(i32 %a) { |
| 28 | ; CHECK-LABEL: f2: |
| 29 | ; CHECK: tmll %r2, 65535 |
| 30 | ; CHECK: jne {{\.L.*}} |
| 31 | ; CHECK: br %r14 |
| 32 | entry: |
| 33 | %and = and i32 %a, 65535 |
| 34 | %cmp = icmp ne i32 %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(i32 %a) { |
| 47 | ; CHECK-LABEL: f3: |
| 48 | ; CHECK: tmlh %r2, 1 |
| 49 | ; CHECK: jne {{\.L.*}} |
| 50 | ; CHECK: br %r14 |
| 51 | entry: |
| 52 | %and = and i32 %a, 65536 |
| 53 | %cmp = icmp ne i32 %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(i32 %a) { |
| 66 | ; CHECK-LABEL: f4: |
| 67 | ; CHECK-NOT: {{tm[lh].}} |
| 68 | ; CHECK: br %r14 |
| 69 | entry: |
| 70 | %and = and i32 %a, 4294901759 |
| 71 | %cmp = icmp eq i32 %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(i32 %a) { |
| 84 | ; CHECK-LABEL: f5: |
| 85 | ; CHECK: tmlh %r2, 65535 |
| 86 | ; CHECK: je {{\.L.*}} |
| 87 | ; CHECK: br %r14 |
| 88 | entry: |
| 89 | %and = and i32 %a, 4294901760 |
| 90 | %cmp = icmp eq i32 %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 | } |