1; RUN: sed -e "s/ORDER/unordered/" %s | llc -march=hexagon | FileCheck %s
2; RUN: sed -e "s/ORDER/monotonic/" %s | llc -march=hexagon | FileCheck %s
3; RUN: sed -e "s/ORDER/release/" %s | llc -march=hexagon | FileCheck %s
4; RUN: sed -e "s/ORDER/seq_cst/" %s | llc -march=hexagon | FileCheck %s
5
6%struct.Obj = type { [100 x i32] }
7
8@i8Src   = global i8 0,  align 1
9@i8Dest  = global i8 0,  align 1
10@i16Src  = global i16 0, align 2
11@i16Dest = global i16 0, align 2
12@i32Src  = global i32 0, align 4
13@i32Dest = global i32 0, align 4
14@i64Src  = global i64 0, align 8
15@i64Dest = global i64 0, align 8
16@ptrSrc  = global %struct.Obj* null, align 4
17@ptrDest = global %struct.Obj* null, align 4
18
19define void @store_i8() #0 {
20entry:
21  %i8Tmp = load i8, i8* @i8Src, align 1
22  store atomic i8 %i8Tmp, i8* @i8Dest ORDER, align 1
23  ret void
24}
25; CHECK-LABEL: store_i8:
26; CHECK: [[TMP_REG:r[0-9]+]] = memub(gp+#i8Src)
27; CHECK: memb(gp+#i8Dest) = [[TMP_REG]]
28
29define void @store_i16() #0 {
30entry:
31  %i16Tmp = load i16, i16* @i16Src, align 2
32  store atomic i16 %i16Tmp, i16* @i16Dest ORDER, align 2
33  ret void
34}
35; CHECK-LABEL: store_i16:
36; CHECK: [[TMP_REG:r[0-9]+]] = memuh(gp+#i16Src)
37; CHECK: memh(gp+#i16Dest) = [[TMP_REG]]
38
39define void @store_i32() #0 {
40entry:
41  %i32Tmp = load i32, i32* @i32Src, align 4
42  store atomic i32 %i32Tmp, i32* @i32Dest ORDER, align 4
43  ret void
44}
45; CHECK-LABEL: store_i32:
46; CHECK: [[TMP_REG:r[0-9]+]] = memw(gp+#i32Src)
47; CHECK: memw(gp+#i32Dest) = [[TMP_REG]]
48
49define void @store_i64() #0 {
50entry:
51  %i64Tmp = load i64, i64* @i64Src, align 8
52  store atomic i64 %i64Tmp, i64* @i64Dest ORDER, align 8
53  ret void
54}
55; CHECK-LABEL: store_i64:
56; CHECK: [[TMP_REG:r[0-9]+:[0-9]+]] = memd(gp+#i64Src)
57; CHECK: memd(gp+#i64Dest) = [[TMP_REG]]
58
59define void @store_ptr() #0 {
60entry:
61  %ptrTmp = load i32, i32* bitcast (%struct.Obj** @ptrSrc to i32*), align 4
62  store atomic i32 %ptrTmp, i32* bitcast (%struct.Obj** @ptrDest to i32*) ORDER, align 4
63  ret void
64}
65; CHECK-LABEL: store_ptr:
66; CHECK: [[TMP_REG:r[0-9]+]] = memw(gp+#ptrSrc)
67; CHECK: memw(gp+#ptrDest) = [[TMP_REG]]
68
69