Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / AArch64 / elf-globaladdress.ll
blob7aa0e564abb88b9df76ceddde9bd4a620cc52d80
1 ;; RUN: llc -mtriple=aarch64-none-linux-gnu -filetype=obj %s -o - | \
2 ;; RUN:   llvm-readobj -h -r - | FileCheck -check-prefix=OBJ %s
4 ; Also take it on a round-trip through llvm-mc to stretch assembly-parsing's legs:
5 ;; RUN: llc -mtriple=aarch64-none-linux-gnu %s -o - | \
6 ;; RUN:     llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o - | \
7 ;; RUN:     llvm-readobj -h -r - | FileCheck -check-prefix=OBJ %s
9 @var8 = dso_local global i8 0
10 @var16 = dso_local global i16 0
11 @var32 = dso_local global i32 0
12 @var64 = dso_local global i64 0
14 define dso_local void @loadstore() {
15     %val8 = load i8, ptr @var8
16     store volatile i8 %val8, ptr @var8
18     %val16 = load i16, ptr @var16
19     store volatile i16 %val16, ptr @var16
21     %val32 = load i32, ptr @var32
22     store volatile i32 %val32, ptr @var32
24     %val64 = load i64, ptr @var64
25     store volatile i64 %val64, ptr @var64
27     ret void
30 @globaddr = dso_local global ptr null
32 define dso_local void @address() {
33     store ptr @var64, ptr @globaddr
34     ret void
37 ; Check we're using EM_AARCH64
38 ; OBJ: ElfHeader {
39 ; OBJ:   Machine: EM_AARCH64
40 ; OBJ: }
42 ; OBJ: Relocations [
43 ; OBJ:   Section {{.*}} .rela.text {
44 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 var8 0x0
45 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST8_ABS_LO12_NC var8 0x0
46 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST8_ABS_LO12_NC var8 0x0
47 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 var16 0x0
48 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST16_ABS_LO12_NC var16 0x0
49 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST16_ABS_LO12_NC var16 0x0
50 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 var32 0x0
51 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST32_ABS_LO12_NC var32 0x0
52 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST32_ABS_LO12_NC var32 0x0
53 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 var64 0x0
54 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST64_ABS_LO12_NC var64 0x0
55 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST64_ABS_LO12_NC var64 0x0
56 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 globaddr 0x0
57 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 var64 0x0
58 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_ADD_ABS_LO12_NC var64 0x0
59 ; OBJ:      0x{{[0-9,A-F]+}} R_AARCH64_LDST64_ABS_LO12_NC globaddr 0x0
61 ; OBJ:   }
62 ; OBJ: ]