xref: /llvm-project/llvm/test/CodeGen/RISCV/atomic-fence.ll (revision 90d79e258ee9c6935ffeac405b3e9b74542068aa)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3; RUN:   | FileCheck --check-prefixes=CHECK,WMO %s
4; RUN: llc -mtriple=riscv32 -mattr=+a -verify-machineinstrs < %s \
5; RUN:   | FileCheck --check-prefixes=CHECK,WMO %s
6; RUN: llc -mtriple=riscv32 -mattr=+a,+ztso -verify-machineinstrs < %s \
7; RUN:   | FileCheck --check-prefixes=CHECK,TSO %s
8; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
9; RUN:   | FileCheck --check-prefixes=CHECK,WMO %s
10; RUN: llc -mtriple=riscv64 -mattr=+a -verify-machineinstrs < %s \
11; RUN:   | FileCheck --check-prefixes=CHECK,WMO %s
12; RUN: llc -mtriple=riscv64 -mattr=+a,+ztso -verify-machineinstrs < %s \
13; RUN:   | FileCheck --check-prefixes=CHECK,TSO %s
14
15define void @fence_acquire() nounwind {
16; WMO-LABEL: fence_acquire:
17; WMO:       # %bb.0:
18; WMO-NEXT:    fence r, rw
19; WMO-NEXT:    ret
20;
21; TSO-LABEL: fence_acquire:
22; TSO:       # %bb.0:
23; TSO-NEXT:    #MEMBARRIER
24; TSO-NEXT:    ret
25  fence acquire
26  ret void
27}
28
29define void @fence_release() nounwind {
30; WMO-LABEL: fence_release:
31; WMO:       # %bb.0:
32; WMO-NEXT:    fence rw, w
33; WMO-NEXT:    ret
34;
35; TSO-LABEL: fence_release:
36; TSO:       # %bb.0:
37; TSO-NEXT:    #MEMBARRIER
38; TSO-NEXT:    ret
39  fence release
40  ret void
41}
42
43define void @fence_acq_rel() nounwind {
44; WMO-LABEL: fence_acq_rel:
45; WMO:       # %bb.0:
46; WMO-NEXT:    fence.tso
47; WMO-NEXT:    ret
48;
49; TSO-LABEL: fence_acq_rel:
50; TSO:       # %bb.0:
51; TSO-NEXT:    #MEMBARRIER
52; TSO-NEXT:    ret
53  fence acq_rel
54  ret void
55}
56
57define void @fence_seq_cst() nounwind {
58; CHECK-LABEL: fence_seq_cst:
59; CHECK:       # %bb.0:
60; CHECK-NEXT:    fence rw, rw
61; CHECK-NEXT:    ret
62  fence seq_cst
63  ret void
64}
65
66define void @fence_singlethread_acquire() nounwind {
67; CHECK-LABEL: fence_singlethread_acquire:
68; CHECK:       # %bb.0:
69; CHECK-NEXT:    #MEMBARRIER
70; CHECK-NEXT:    ret
71  fence syncscope("singlethread") acquire
72  ret void
73}
74
75define void @fence_singlethread_release() nounwind {
76; CHECK-LABEL: fence_singlethread_release:
77; CHECK:       # %bb.0:
78; CHECK-NEXT:    #MEMBARRIER
79; CHECK-NEXT:    ret
80  fence syncscope("singlethread") release
81  ret void
82}
83
84define void @fence_singlethread_acq_rel() nounwind {
85; CHECK-LABEL: fence_singlethread_acq_rel:
86; CHECK:       # %bb.0:
87; CHECK-NEXT:    #MEMBARRIER
88; CHECK-NEXT:    ret
89  fence syncscope("singlethread") acq_rel
90  ret void
91}
92
93define void @fence_singlethread_seq_cst() nounwind {
94; CHECK-LABEL: fence_singlethread_seq_cst:
95; CHECK:       # %bb.0:
96; CHECK-NEXT:    #MEMBARRIER
97; CHECK-NEXT:    ret
98  fence syncscope("singlethread") seq_cst
99  ret void
100}
101