1 ; RUN: llc < %s -march=x86-64 | FileCheck %s 2 3 ; rdar://7103704 4 5 define void @sub1(i32* nocapture %p, i32 %v) nounwind ssp { 6 entry: 7 ; CHECK: sub1: 8 ; CHECK: subl 9 %0 = atomicrmw sub i32* %p, i32 %v monotonic 10 ret void 11 } 12 13 define void @inc4(i64* nocapture %p) nounwind ssp { 14 entry: 15 ; CHECK: inc4: 16 ; CHECK: incq 17 %0 = atomicrmw add i64* %p, i64 1 monotonic 18 ret void 19 } 20 21 define void @add8(i64* nocapture %p) nounwind ssp { 22 entry: 23 ; CHECK: add8: 24 ; CHECK: addq $2 25 %0 = atomicrmw add i64* %p, i64 2 monotonic 26 ret void 27 } 28 29 define void @add4(i64* nocapture %p, i32 %v) nounwind ssp { 30 entry: 31 ; CHECK: add4: 32 ; CHECK: addq 33 %0 = sext i32 %v to i64 ; <i64> [#uses=1] 34 %1 = atomicrmw add i64* %p, i64 %0 monotonic 35 ret void 36 } 37 38 define void @inc3(i8* nocapture %p) nounwind ssp { 39 entry: 40 ; CHECK: inc3: 41 ; CHECK: incb 42 %0 = atomicrmw add i8* %p, i8 1 monotonic 43 ret void 44 } 45 46 define void @add7(i8* nocapture %p) nounwind ssp { 47 entry: 48 ; CHECK: add7: 49 ; CHECK: addb $2 50 %0 = atomicrmw add i8* %p, i8 2 monotonic 51 ret void 52 } 53 54 define void @add3(i8* nocapture %p, i32 %v) nounwind ssp { 55 entry: 56 ; CHECK: add3: 57 ; CHECK: addb 58 %0 = trunc i32 %v to i8 ; <i8> [#uses=1] 59 %1 = atomicrmw add i8* %p, i8 %0 monotonic 60 ret void 61 } 62 63 define void @inc2(i16* nocapture %p) nounwind ssp { 64 entry: 65 ; CHECK: inc2: 66 ; CHECK: incw 67 %0 = atomicrmw add i16* %p, i16 1 monotonic 68 ret void 69 } 70 71 define void @add6(i16* nocapture %p) nounwind ssp { 72 entry: 73 ; CHECK: add6: 74 ; CHECK: addw $2 75 %0 = atomicrmw add i16* %p, i16 2 monotonic 76 ret void 77 } 78 79 define void @add2(i16* nocapture %p, i32 %v) nounwind ssp { 80 entry: 81 ; CHECK: add2: 82 ; CHECK: addw 83 %0 = trunc i32 %v to i16 ; <i16> [#uses=1] 84 %1 = atomicrmw add i16* %p, i16 %0 monotonic 85 ret void 86 } 87 88 define void @inc1(i32* nocapture %p) nounwind ssp { 89 entry: 90 ; CHECK: inc1: 91 ; CHECK: incl 92 %0 = atomicrmw add i32* %p, i32 1 monotonic 93 ret void 94 } 95 96 define void @add5(i32* nocapture %p) nounwind ssp { 97 entry: 98 ; CHECK: add5: 99 ; CHECK: addl $2 100 %0 = atomicrmw add i32* %p, i32 2 monotonic 101 ret void 102 } 103 104 define void @add1(i32* nocapture %p, i32 %v) nounwind ssp { 105 entry: 106 ; CHECK: add1: 107 ; CHECK: addl 108 %0 = atomicrmw add i32* %p, i32 %v monotonic 109 ret void 110 } 111 112 define void @dec4(i64* nocapture %p) nounwind ssp { 113 entry: 114 ; CHECK: dec4: 115 ; CHECK: decq 116 %0 = atomicrmw sub i64* %p, i64 1 monotonic 117 ret void 118 } 119 120 define void @sub8(i64* nocapture %p) nounwind ssp { 121 entry: 122 ; CHECK: sub8: 123 ; CHECK: subq $2 124 %0 = atomicrmw sub i64* %p, i64 2 monotonic 125 ret void 126 } 127 128 define void @sub4(i64* nocapture %p, i32 %v) nounwind ssp { 129 entry: 130 ; CHECK: sub4: 131 ; CHECK: subq 132 %0 = sext i32 %v to i64 ; <i64> [#uses=1] 133 %1 = atomicrmw sub i64* %p, i64 %0 monotonic 134 ret void 135 } 136 137 define void @dec3(i8* nocapture %p) nounwind ssp { 138 entry: 139 ; CHECK: dec3: 140 ; CHECK: decb 141 %0 = atomicrmw sub i8* %p, i8 1 monotonic 142 ret void 143 } 144 145 define void @sub7(i8* nocapture %p) nounwind ssp { 146 entry: 147 ; CHECK: sub7: 148 ; CHECK: subb $2 149 %0 = atomicrmw sub i8* %p, i8 2 monotonic 150 ret void 151 } 152 153 define void @sub3(i8* nocapture %p, i32 %v) nounwind ssp { 154 entry: 155 ; CHECK: sub3: 156 ; CHECK: subb 157 %0 = trunc i32 %v to i8 ; <i8> [#uses=1] 158 %1 = atomicrmw sub i8* %p, i8 %0 monotonic 159 ret void 160 } 161 162 define void @dec2(i16* nocapture %p) nounwind ssp { 163 entry: 164 ; CHECK: dec2: 165 ; CHECK: decw 166 %0 = atomicrmw sub i16* %p, i16 1 monotonic 167 ret void 168 } 169 170 define void @sub6(i16* nocapture %p) nounwind ssp { 171 entry: 172 ; CHECK: sub6: 173 ; CHECK: subw $2 174 %0 = atomicrmw sub i16* %p, i16 2 monotonic 175 ret void 176 } 177 178 define void @sub2(i16* nocapture %p, i32 %v) nounwind ssp { 179 entry: 180 ; CHECK: sub2: 181 ; CHECK: negl 182 %0 = trunc i32 %v to i16 ; <i16> [#uses=1] 183 %1 = atomicrmw sub i16* %p, i16 %0 monotonic 184 ret void 185 } 186 187 define void @dec1(i32* nocapture %p) nounwind ssp { 188 entry: 189 ; CHECK: dec1: 190 ; CHECK: decl 191 %0 = atomicrmw sub i32* %p, i32 1 monotonic 192 ret void 193 } 194 195 define void @sub5(i32* nocapture %p) nounwind ssp { 196 entry: 197 ; CHECK: sub5: 198 ; CHECK: subl $2 199 %0 = atomicrmw sub i32* %p, i32 2 monotonic 200 ret void 201 } 202