1 ; RUN: llc < %s -mtriple=armv7 -mattr=+db | FileCheck %s
2 ; RUN: llc < %s -mtriple=thumbv7 -mattr=+db | FileCheck %s
6 call void @llvm.arm.dmb(i32 3) ; CHECK: dmb osh
7 call void @llvm.arm.dsb(i32 7) ; CHECK: dsb nsh
8 call void @llvm.arm.isb(i32 15) ; CHECK: isb sy
12 ; Important point is that the compiler should not reorder memory access
13 ; instructions around DMB.
14 ; Failure to do so, two STRs will collapse into one STRD.
15 ; CHECK-LABEL: test_dmb_reordering
16 define void @test_dmb_reordering(i32 %a, i32 %b, ptr %d) {
17 store i32 %a, ptr %d ; CHECK: str {{r[0-9]+}}, [{{r[0-9]+}}]
19 call void @llvm.arm.dmb(i32 15) ; CHECK: dmb sy
21 %d1 = getelementptr i32, ptr %d, i32 1
22 store i32 %b, ptr %d1 ; CHECK: str {{r[0-9]+}}, [{{r[0-9]+}}, #4]
28 ; CHECK-LABEL: test_dsb_reordering
29 define void @test_dsb_reordering(i32 %a, i32 %b, ptr %d) {
30 store i32 %a, ptr %d ; CHECK: str {{r[0-9]+}}, [{{r[0-9]+}}]
32 call void @llvm.arm.dsb(i32 15) ; CHECK: dsb sy
34 %d1 = getelementptr i32, ptr %d, i32 1
35 store i32 %b, ptr %d1 ; CHECK: str {{r[0-9]+}}, [{{r[0-9]+}}, #4]
41 ; CHECK-LABEL: test_isb_reordering
42 define void @test_isb_reordering(i32 %a, i32 %b, ptr %d) {
43 store i32 %a, ptr %d ; CHECK: str {{r[0-9]+}}, [{{r[0-9]+}}]
45 call void @llvm.arm.isb(i32 15) ; CHECK: isb sy
47 %d1 = getelementptr i32, ptr %d, i32 1
48 store i32 %b, ptr %d1 ; CHECK: str {{r[0-9]+}}, [{{r[0-9]+}}, #4]
53 declare void @llvm.arm.dmb(i32)
54 declare void @llvm.arm.dsb(i32)
55 declare void @llvm.arm.isb(i32)