1 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=X64ALL --check-prefix=X64
2 # RUN: llc -mtriple=x86_64-apple-darwin -relocation-model=pic -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=X64ALL --check-prefix=X64_DARWIN_PIC
6 @g_int = global i32 0, align 4
8 define void @test_global_ptrv() {
10 store i32* @g_int, i32** undef
14 define i32 @test_global_valv() {
16 %0 = load i32, i32* @g_int, align 4
22 name: test_global_ptrv
23 # CHECK-LABEL: name: test_global_ptrv
28 # X64ALL-NEXT: - { id: 0, class: gr64, preferred-register: '' }
29 # X64ALL-NEXT: - { id: 1, class: gr64, preferred-register: '' }
32 - { id: 0, class: gpr, preferred-register: '' }
33 - { id: 1, class: gpr, preferred-register: '' }
34 # X64: %0:gr64 = IMPLICIT_DEF
35 # X64-NEXT: %1:gr64 = LEA64r $noreg, 1, $noreg, @g_int, $noreg
36 # X64-NEXT: MOV64mr %0, 1, $noreg, 0, $noreg, %1 :: (store 8 into `i32** undef`)
39 # X64_DARWIN_PIC: %0:gr64 = IMPLICIT_DEF
40 # X64_DARWIN_PIC-NEXT: %1:gr64 = LEA64r $rip, 1, $noreg, @g_int, $noreg
41 # X64_DARWIN_PIC-NEXT: MOV64mr %0, 1, $noreg, 0, $noreg, %1 :: (store 8 into `i32** undef`)
42 # X64_DARWIN_PIC-NEXT: RET 0
49 %1(p0) = G_GLOBAL_VALUE @g_int
50 G_STORE %1(p0), %0(p0) :: (store 8 into `i32** undef`)
55 name: test_global_valv
56 # CHECK-LABEL: name: test_global_valv
61 # X64ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' }
62 # X64ALL-NEXT: - { id: 1, class: gr64, preferred-register: '' }
65 - { id: 0, class: gpr, preferred-register: '' }
66 - { id: 1, class: gpr, preferred-register: '' }
67 # X64: %1:gr64 = LEA64r $noreg, 1, $noreg, @g_int, $noreg
68 # X64-NEXT: %0:gr32 = MOV32rm %1, 1, $noreg, 0, $noreg :: (load 4 from @g_int)
69 # X64-NEXT: $eax = COPY %0
70 # X64-NEXT: RET 0, implicit $eax
72 # X64_DARWIN_PIC: %1:gr64 = LEA64r $rip, 1, $noreg, @g_int, $noreg
73 # X64_DARWIN_PIC-NEXT: %0:gr32 = MOV32rm %1, 1, $noreg, 0, $noreg :: (load 4 from @g_int)
74 # X64_DARWIN_PIC-NEXT: $eax = COPY %0
75 # X64_DARWIN_PIC-NEXT: RET 0, implicit $eax
79 %1(p0) = G_GLOBAL_VALUE @g_int
80 %0(s32) = G_LOAD %1(p0) :: (load 4 from @g_int)