1 ; RUN: llc -O0 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-UNOPT,DEFCM
2 ; RUN: llc -O1 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-OPT,DEFCM
3 ; RUN: llc -O2 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-OPT,DEFCM
4 ; RUN: llc -O3 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-OPT,DEFCM
5 ; RUN: llc -O1 -code-model=large < %s | FileCheck %s --check-prefixes=CHECK,CHECK-OPT,LARGE
7 target triple = "aarch64-unknown-linux-gnu"
9 @foo = dso_local global i64 0, align 8
10 @bar = dso_local global i64 0, align 8
12 define i64 @multiple() !pcsections !0 {
13 ; CHECK-LABEL: multiple:
14 ; CHECK: .Lfunc_begin0:
15 ; CHECK: // %bb.0: // %entry
16 ; CHECK: .Lpcsection0:
19 ; CHECK: .section section_no_aux,"awo",@progbits,.text
20 ; CHECK-NEXT: .Lpcsection_base0:
21 ; DEFCM-NEXT: .word .Lfunc_begin0-.Lpcsection_base0
22 ; LARGE-NEXT: .xword .Lfunc_begin0-.Lpcsection_base0
23 ; CHECK-NEXT: .word .Lfunc_end0-.Lfunc_begin0
24 ; CHECK-NEXT: .section section_aux_42,"awo",@progbits,.text
25 ; CHECK-NEXT: .Lpcsection_base1:
26 ; DEFCM-NEXT: .word .Lpcsection0-.Lpcsection_base1
27 ; LARGE-NEXT: .xword .Lpcsection0-.Lpcsection_base1
28 ; CHECK-NEXT: .word 42
29 ; CHECK-NEXT: .section section_aux_21264,"awo",@progbits,.text
30 ; CHECK-NEXT: .Lpcsection_base2:
31 ; DEFCM-NEXT: .word .Lpcsection0-.Lpcsection_base2
32 ; LARGE-NEXT: .xword .Lpcsection0-.Lpcsection_base2
33 ; CHECK-NEXT: .word 21264
36 %0 = load i64, ptr @bar, align 8, !pcsections !1
40 define i64 @test_simple_atomic() {
41 ; CHECK-LABEL: test_simple_atomic:
42 ; CHECK: .Lpcsection1:
44 ; CHECK-NOT: .Lpcsection2
48 ; CHECK: .section section_no_aux,"awo",@progbits,.text
49 ; CHECK-NEXT: .Lpcsection_base3:
50 ; DEFCM-NEXT: .word .Lpcsection1-.Lpcsection_base3
51 ; LARGE-NEXT: .xword .Lpcsection1-.Lpcsection_base3
54 %0 = load atomic i64, ptr @foo monotonic, align 8, !pcsections !0
55 %1 = load i64, ptr @bar, align 8
56 %add = add nsw i64 %1, %0
60 define i64 @test_complex_atomic() {
61 ; CHECK-LABEL: test_complex_atomic:
63 ; CHECK-OPT: .Lpcsection2:
64 ; CHECK-OPT-NEXT: ldxr
65 ; CHECK-OPT: .Lpcsection3:
67 ; CHECK-OPT: .Lpcsection4:
68 ; CHECK-OPT-NEXT: stxr
69 ; CHECK-OPT: .Lpcsection5:
70 ; CHECK-OPT-NEXT: cbnz
72 ; CHECK-UNOPT: .Lpcsection2:
73 ; CHECK-UNOPT-NEXT: ldr
74 ; CHECK-UNOPT: .Lpcsection4:
75 ; CHECK-UNOPT-NEXT: add
76 ; CHECK-UNOPT: .Lpcsection5:
77 ; CHECK-UNOPT-NEXT: ldaxr
78 ; CHECK-UNOPT: .Lpcsection6:
79 ; CHECK-UNOPT-NEXT: cmp
80 ; CHECK-UNOPT: .Lpcsection8:
81 ; CHECK-UNOPT-NEXT: stlxr
82 ; CHECK-UNOPT: .Lpcsection9:
83 ; CHECK-UNOPT-NEXT: cbnz
84 ; CHECK-UNOPT: .Lpcsection13:
87 ; CHECK-NOT: .Lpcsection
90 ; CHECK: .section section_no_aux,"awo",@progbits,.text
91 ; CHECK-NEXT: .Lpcsection_base4:
92 ; DEFCM-NEXT: .word .Lpcsection2-.Lpcsection_base4
93 ; LARGE-NEXT: .xword .Lpcsection2-.Lpcsection_base4
94 ; CHECK-NEXT: .Lpcsection_base5:
95 ; DEFCM-NEXT: .word .Lpcsection3-.Lpcsection_base5
96 ; LARGE-NEXT: .xword .Lpcsection3-.Lpcsection_base5
97 ; CHECK-NEXT: .Lpcsection_base6:
98 ; DEFCM-NEXT: .word .Lpcsection4-.Lpcsection_base6
99 ; LARGE-NEXT: .xword .Lpcsection4-.Lpcsection_base6
100 ; CHECK-NEXT: .Lpcsection_base7:
101 ; DEFCM-NEXT: .word .Lpcsection5-.Lpcsection_base7
102 ; LARGE-NEXT: .xword .Lpcsection5-.Lpcsection_base7
103 ; CHECK-UNOPT: .word .Lpcsection13-.Lpcsection_base15
106 %0 = atomicrmw add ptr @foo, i64 1 monotonic, align 8, !pcsections !0
107 %1 = load i64, ptr @bar, align 8
108 %inc = add nsw i64 %1, 1
109 store i64 %inc, ptr @bar, align 8
110 %add = add nsw i64 %1, %0
114 !0 = !{!"section_no_aux"}
115 !1 = !{!"section_aux_42", !2, !"section_aux_21264", !3}