| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 1 | ; Test 64-bit atomic NANDs. |
| 2 | ; |
| Richard Sandiford | c57e586 | 2013-07-19 16:24:22 +0000 | [diff] [blame] | 3 | ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 4 | |
| 5 | ; Check NANDs of a variable. |
| 6 | define i64 @f1(i64 %dummy, i64 *%src, i64 %b) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 7 | ; CHECK-LABEL: f1: |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 8 | ; CHECK: lg %r2, 0(%r3) |
| 9 | ; CHECK: [[LABEL:\.[^:]*]]: |
| 10 | ; CHECK: lgr %r0, %r2 |
| 11 | ; CHECK: ngr %r0, %r4 |
| 12 | ; CHECK: lcgr %r0, %r0 |
| 13 | ; CHECK: aghi %r0, -1 |
| 14 | ; CHECK: csg %r2, %r0, 0(%r3) |
| Richard Sandiford | 3d768e3 | 2013-07-31 12:30:20 +0000 | [diff] [blame] | 15 | ; CHECK: jl [[LABEL]] |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 16 | ; CHECK: br %r14 |
| 17 | %res = atomicrmw nand i64 *%src, i64 %b seq_cst |
| 18 | ret i64 %res |
| 19 | } |
| 20 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 21 | ; Check NANDs of 1, which are done using a register. (We could use RISBG |
| 22 | ; instead, but that isn't implemented yet.) |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 23 | define i64 @f2(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 24 | ; CHECK-LABEL: f2: |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 25 | ; CHECK: ngr |
| 26 | ; CHECK: br %r14 |
| 27 | %res = atomicrmw nand i64 *%src, i64 1 seq_cst |
| 28 | ret i64 %res |
| 29 | } |
| 30 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 31 | ; Check the equivalent of NIHF with 1, which can use RISBG instead. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 32 | define i64 @f3(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 33 | ; CHECK-LABEL: f3: |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 34 | ; CHECK: lg %r2, 0(%r3) |
| 35 | ; CHECK: [[LABEL:\.[^:]*]]: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 36 | ; CHECK: risbg %r0, %r2, 31, 191, 0 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 37 | ; CHECK: lcgr %r0, %r0 |
| 38 | ; CHECK: aghi %r0, -1 |
| 39 | ; CHECK: csg %r2, %r0, 0(%r3) |
| Richard Sandiford | 3d768e3 | 2013-07-31 12:30:20 +0000 | [diff] [blame] | 40 | ; CHECK: jl [[LABEL]] |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 41 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 42 | %res = atomicrmw nand i64 *%src, i64 8589934591 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 43 | ret i64 %res |
| 44 | } |
| 45 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 46 | ; Check the lowest NIHF value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 47 | define i64 @f4(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 48 | ; CHECK-LABEL: f4: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 49 | ; CHECK: lg %r2, 0(%r3) |
| 50 | ; CHECK: [[LABEL:\.[^:]*]]: |
| 51 | ; CHECK: lgr %r0, %r2 |
| 52 | ; CHECK: nihf %r0, 2 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 53 | ; CHECK: lcgr %r0, %r0 |
| 54 | ; CHECK: aghi %r0, -1 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 55 | ; CHECK: csg %r2, %r0, 0(%r3) |
| Richard Sandiford | 3d768e3 | 2013-07-31 12:30:20 +0000 | [diff] [blame] | 56 | ; CHECK: jl [[LABEL]] |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 57 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 58 | %res = atomicrmw nand i64 *%src, i64 12884901887 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 59 | ret i64 %res |
| 60 | } |
| 61 | |
| 62 | ; Check the next value up, which must use a register. |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 63 | define i64 @f5(i64 %dummy, i64 *%src) { |
| 64 | ; CHECK-LABEL: f5: |
| 65 | ; CHECK: ngr |
| 66 | ; CHECK: br %r14 |
| 67 | %res = atomicrmw nand i64 *%src, i64 12884901888 seq_cst |
| 68 | ret i64 %res |
| 69 | } |
| 70 | |
| 71 | ; Check the lowest NIHH value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 72 | define i64 @f6(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 73 | ; CHECK-LABEL: f6: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 74 | ; CHECK: nihh {{%r[0-5]}}, 2 |
| 75 | ; CHECK: br %r14 |
| 76 | %res = atomicrmw nand i64 *%src, i64 844424930131967 seq_cst |
| 77 | ret i64 %res |
| 78 | } |
| 79 | |
| 80 | ; Check the next value up, which must use a register. |
| 81 | define i64 @f7(i64 %dummy, i64 *%src) { |
| 82 | ; CHECK-LABEL: f7: |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 83 | ; CHECK: ngr |
| 84 | ; CHECK: br %r14 |
| 85 | %res = atomicrmw nand i64 *%src, i64 281474976710656 seq_cst |
| 86 | ret i64 %res |
| 87 | } |
| 88 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 89 | ; Check the highest NILL value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 90 | define i64 @f8(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 91 | ; CHECK-LABEL: f8: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 92 | ; CHECK: nill {{%r[0-5]}}, 65530 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 93 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 94 | %res = atomicrmw nand i64 *%src, i64 -6 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 95 | ret i64 %res |
| 96 | } |
| 97 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 98 | ; Check the lowest NILL value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 99 | define i64 @f9(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 100 | ; CHECK-LABEL: f9: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 101 | ; CHECK: nill {{%r[0-5]}}, 2 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 102 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 103 | %res = atomicrmw nand i64 *%src, i64 -65534 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 104 | ret i64 %res |
| 105 | } |
| 106 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 107 | ; Check the highest useful NILF value. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 108 | define i64 @f10(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 109 | ; CHECK-LABEL: f10: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 110 | ; CHECK: nilf {{%r[0-5]}}, 4294901758 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 111 | ; CHECK: br %r14 |
| 112 | %res = atomicrmw nand i64 *%src, i64 -65538 seq_cst |
| 113 | ret i64 %res |
| 114 | } |
| 115 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 116 | ; Check the highest NILH value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 117 | define i64 @f11(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 118 | ; CHECK-LABEL: f11: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 119 | ; CHECK: nilh {{%r[0-5]}}, 65530 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 120 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 121 | %res = atomicrmw nand i64 *%src, i64 -327681 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 122 | ret i64 %res |
| 123 | } |
| 124 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 125 | ; Check the lowest NILH value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 126 | define i64 @f12(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 127 | ; CHECK-LABEL: f12: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 128 | ; CHECK: nilh {{%r[0-5]}}, 2 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 129 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 130 | %res = atomicrmw nand i64 *%src, i64 -4294770689 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 131 | ret i64 %res |
| 132 | } |
| 133 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 134 | ; Check the lowest NILF value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 135 | define i64 @f13(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 136 | ; CHECK-LABEL: f13: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 137 | ; CHECK: nilf {{%r[0-5]}}, 2 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 138 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 139 | %res = atomicrmw nand i64 *%src, i64 -4294967294 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 140 | ret i64 %res |
| 141 | } |
| 142 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 143 | ; Check the highest NIHL value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 144 | define i64 @f14(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 145 | ; CHECK-LABEL: f14: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 146 | ; CHECK: nihl {{%r[0-5]}}, 65530 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 147 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 148 | %res = atomicrmw nand i64 *%src, i64 -21474836481 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 149 | ret i64 %res |
| 150 | } |
| 151 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 152 | ; Check the lowest NIHL value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 153 | define i64 @f15(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 154 | ; CHECK-LABEL: f15: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 155 | ; CHECK: nihl {{%r[0-5]}}, 2 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 156 | ; CHECK: br %r14 |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 157 | %res = atomicrmw nand i64 *%src, i64 -281462091808769 seq_cst |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 158 | ret i64 %res |
| 159 | } |
| 160 | |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 161 | ; Check the highest NIHH value outside the range of RISBG. |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 162 | define i64 @f16(i64 %dummy, i64 *%src) { |
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 163 | ; CHECK-LABEL: f16: |
| Richard Sandiford | 6a06ba3 | 2013-07-31 11:36:35 +0000 | [diff] [blame] | 164 | ; CHECK: nihh {{%r[0-5]}}, 65530 |
| 165 | ; CHECK: br %r14 |
| 166 | %res = atomicrmw nand i64 *%src, i64 -1407374883553281 seq_cst |
| 167 | ret i64 %res |
| 168 | } |
| 169 | |
| 170 | ; Check the highest useful NIHF value. |
| 171 | define i64 @f17(i64 %dummy, i64 *%src) { |
| 172 | ; CHECK-LABEL: f17: |
| 173 | ; CHECK: nihf {{%r[0-5]}}, 4294901758 |
| Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 174 | ; CHECK: br %r14 |
| 175 | %res = atomicrmw nand i64 *%src, i64 -281479271677953 seq_cst |
| 176 | ret i64 %res |
| 177 | } |