1 # RUN: llc -mtriple=i386-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=X32ALL --check-prefix=X32
2 # RUN: llc -mtriple=x86_64-linux-gnux32 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=X32ALL --check-prefix=X32ABI
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 # X32-NEXT: - { id: 0, class: gr32, preferred-register: '' }
29 # X32-NEXT: - { id: 1, class: gr32, preferred-register: '' }
32 # X32ABI-NEXT: - { id: 0, class: low32_addr_access, preferred-register: '' }
33 # X32ABI-NEXT: - { id: 1, class: gr32, preferred-register: '' }
35 - { id: 0, class: gpr, preferred-register: '' }
36 - { id: 1, class: gpr, preferred-register: '' }
37 # X32: %0:gr32 = IMPLICIT_DEF
38 # X32-NEXT: %1:gr32 = LEA32r $noreg, 1, $noreg, @g_int, $noreg
39 # X32-NEXT: MOV32mr %0, 1, $noreg, 0, $noreg, %1 :: (store 4 into `i32** undef`)
42 # X32ABI: %0:low32_addr_access = IMPLICIT_DEF
43 # X32ABI-NEXT: %1:gr32 = LEA64_32r $noreg, 1, $noreg, @g_int, $noreg
44 # X32ABI-NEXT: MOV32mr %0, 1, $noreg, 0, $noreg, %1 :: (store 4 into `i32** undef`)
51 %1(p0) = G_GLOBAL_VALUE @g_int
52 G_STORE %1(p0), %0(p0) :: (store 4 into `i32** undef`)
57 name: test_global_valv
58 # CHECK-LABEL: name: test_global_valv
63 # X32ALL-NEXT: - { id: 0, class: gr32, preferred-register: '' }
64 # X32ALL-NEXT: - { id: 1, class: gr32, preferred-register: '' }
66 - { id: 0, class: gpr, preferred-register: '' }
67 - { id: 1, class: gpr, preferred-register: '' }
68 # X32: %1:gr32 = LEA32r $noreg, 1, $noreg, @g_int, $noreg
69 # X32-NEXT: %0:gr32 = MOV32rm %1, 1, $noreg, 0, $noreg :: (load 4 from @g_int)
70 # X32-NEXT: $eax = COPY %0
71 # X32-NEXT: RET 0, implicit $eax
73 # X32ABI: %1:gr32 = LEA64_32r $noreg, 1, $noreg, @g_int, $noreg
74 # X32ABI-NEXT: %0:gr32 = MOV32rm %1, 1, $noreg, 0, $noreg :: (load 4 from @g_int)
75 # X32ABI-NEXT: $eax = COPY %0
76 # X32ABI-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)