1 ; RUN: llc < %s -march=x86-64 -verify-machineinstrs | FileCheck %s 2 3 ; rdar://7103704 4 5 define void @sub1(i32* nocapture %p, i32 %v) nounwind ssp { 6 entry: 7 ; CHECK-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: sub2: 181 ; CHECK-NOT: negl 182 ; CHECK: subw 183 %0 = trunc i32 %v to i16 ; <i16> [#uses=1] 184 %1 = atomicrmw sub i16* %p, i16 %0 monotonic 185 ret void 186 } 187 188 define void @dec1(i32* nocapture %p) nounwind ssp { 189 entry: 190 ; CHECK-LABEL: dec1: 191 ; CHECK: decl 192 %0 = atomicrmw sub i32* %p, i32 1 monotonic 193 ret void 194 } 195 196 define void @sub5(i32* nocapture %p) nounwind ssp { 197 entry: 198 ; CHECK-LABEL: sub5: 199 ; CHECK: subl $2 200 %0 = atomicrmw sub i32* %p, i32 2 monotonic 201 ret void 202 } 203