1 ; RUN: llc < %s -O0 -mtriple=x86_64-unknown-unknown -mcpu=corei7 -verify-machineinstrs -show-mc-encoding | FileCheck %s --check-prefix X64
2 ; RUN: llc < %s -O0 -mtriple=i386-unknown-unknown -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X32
4 @sc16 = external global i16
6 define void @atomic_fetch_add16() nounwind {
7 ; X64: atomic_fetch_add16
8 ; X32: atomic_fetch_add16
11 %t1 = atomicrmw add i16* @sc16, i16 1 acquire
16 %t2 = atomicrmw add i16* @sc16, i16 3 acquire
18 ; X64: addw $3, {{.*}} # encoding: [0xf0,0x66
21 %t3 = atomicrmw add i16* @sc16, i16 5 acquire
23 ; X64: xaddw {{.*}} # encoding: [0xf0,0x66
26 %t4 = atomicrmw add i16* @sc16, i16 %t3 acquire
28 ; X64: addw {{.*}} # encoding: [0xf0,0x66
36 define void @atomic_fetch_sub16() nounwind {
37 ; X64: atomic_fetch_sub16
38 ; X32: atomic_fetch_sub16
39 %t1 = atomicrmw sub i16* @sc16, i16 1 acquire
44 %t2 = atomicrmw sub i16* @sc16, i16 3 acquire
46 ; X64: subw $3, {{.*}} # encoding: [0xf0,0x66
49 %t3 = atomicrmw sub i16* @sc16, i16 5 acquire
51 ; X64: xaddw {{.*}} # encoding: [0xf0,0x66
54 %t4 = atomicrmw sub i16* @sc16, i16 %t3 acquire
56 ; X64: subw {{.*}} # encoding: [0xf0,0x66
64 define void @atomic_fetch_and16() nounwind {
65 ; X64: atomic_fetch_and16
66 ; X32: atomic_fetch_and16
67 %t1 = atomicrmw and i16* @sc16, i16 3 acquire
69 ; X64: andw $3, {{.*}} # encoding: [0xf0,0x66
72 %t2 = atomicrmw and i16* @sc16, i16 5 acquire
79 %t3 = atomicrmw and i16* @sc16, i16 %t2 acquire
81 ; X64: andw {{.*}} # encoding: [0xf0,0x66
89 define void @atomic_fetch_or16() nounwind {
90 ; X64: atomic_fetch_or16
91 ; X32: atomic_fetch_or16
92 %t1 = atomicrmw or i16* @sc16, i16 3 acquire
94 ; X64: orw $3, {{.*}} # encoding: [0xf0,0x66
97 %t2 = atomicrmw or i16* @sc16, i16 5 acquire
104 %t3 = atomicrmw or i16* @sc16, i16 %t2 acquire
106 ; X64: orw {{.*}} # encoding: [0xf0,0x66
114 define void @atomic_fetch_xor16() nounwind {
115 ; X64: atomic_fetch_xor16
116 ; X32: atomic_fetch_xor16
117 %t1 = atomicrmw xor i16* @sc16, i16 3 acquire
119 ; X64: xorw $3, {{.*}} # encoding: [0xf0,0x66
122 %t2 = atomicrmw xor i16* @sc16, i16 5 acquire
129 %t3 = atomicrmw xor i16* @sc16, i16 %t2 acquire
131 ; X64: xorw {{.*}} # encoding: [0xf0,0x66
139 define void @atomic_fetch_nand16(i16 %x) nounwind {
140 ; X64: atomic_fetch_nand16
141 ; X32: atomic_fetch_nand16
142 %t1 = atomicrmw nand i16* @sc16, i16 %x acquire
156 define void @atomic_fetch_max16(i16 %x) nounwind {
157 %t1 = atomicrmw max i16* @sc16, i16 %x acquire
172 define void @atomic_fetch_min16(i16 %x) nounwind {
173 %t1 = atomicrmw min i16* @sc16, i16 %x acquire
188 define void @atomic_fetch_umax16(i16 %x) nounwind {
189 %t1 = atomicrmw umax i16* @sc16, i16 %x acquire
204 define void @atomic_fetch_umin16(i16 %x) nounwind {
205 %t1 = atomicrmw umin i16* @sc16, i16 %x acquire
219 define void @atomic_fetch_cmpxchg16() nounwind {
220 %t1 = cmpxchg i16* @sc16, i16 0, i16 1 acquire
230 define void @atomic_fetch_store16(i16 %x) nounwind {
231 store atomic i16 %x, i16* @sc16 release, align 4
241 define void @atomic_fetch_swap16(i16 %x) nounwind {
242 %t1 = atomicrmw xchg i16* @sc16, i16 %x acquire