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