1 ; RUN: llc < %s -mtriple=aarch64 -O=3 | FileCheck %s
5 call void @llvm.aarch64.dmb(i32 15)
7 call void @llvm.aarch64.dmb(i32 3)
9 call void @llvm.aarch64.dsb(i32 15)
11 call void @llvm.aarch64.dsb(i32 9)
13 call void @llvm.aarch64.isb(i32 15)
17 ; Important point is that the compiler should not reorder memory access
18 ; instructions around DMB.
19 ; Failure to do so, two STRs will collapse into one STP.
20 define void @test_dmb_reordering(i32 %a, i32 %b, ptr %d) {
21 store i32 %a, ptr %d ; CHECK: str {{w[0-9]+}}, [{{x[0-9]+}}]
23 call void @llvm.aarch64.dmb(i32 15); CHECK: dmb sy
25 %d1 = getelementptr i32, ptr %d, i64 1
26 store i32 %b, ptr %d1 ; CHECK: str {{w[0-9]+}}, [{{x[0-9]+}}, #4]
32 define void @test_dsb_reordering(i32 %a, i32 %b, ptr %d) {
33 store i32 %a, ptr %d ; CHECK: str {{w[0-9]+}}, [{{x[0-9]+}}]
35 call void @llvm.aarch64.dsb(i32 15); CHECK: dsb sy
37 %d1 = getelementptr i32, ptr %d, i64 1
38 store i32 %b, ptr %d1 ; CHECK: str {{w[0-9]+}}, [{{x[0-9]+}}, #4]
44 define void @test_isb_reordering(i32 %a, i32 %b, ptr %d) {
45 store i32 %a, ptr %d ; CHECK: str {{w[0-9]+}}, [{{x[0-9]+}}]
47 call void @llvm.aarch64.isb(i32 15); CHECK: isb
49 %d1 = getelementptr i32, ptr %d, i64 1
50 store i32 %b, ptr %d1 ; CHECK: str {{w[0-9]+}}, [{{x[0-9]+}}, #4]
55 declare void @llvm.aarch64.dmb(i32)
56 declare void @llvm.aarch64.dsb(i32)
57 declare void @llvm.aarch64.isb(i32)