• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-linux-gnu    -global-isel -verify-machineinstrs                       < %s -o - | FileCheck %s --check-prefix=X64
3; RUN: llc -mtriple=x86_64-apple-darwin -global-isel -verify-machineinstrs -relocation-model=pic < %s -o - | FileCheck %s --check-prefix=X64_DARWIN_PIC
4; RUN: llc -mtriple=i386-linux-gnu      -global-isel -verify-machineinstrs                       < %s -o - | FileCheck %s --check-prefix=X32
5; RUN: llc -mtriple=x86_64-linux-gnux32 -global-isel -verify-machineinstrs                       < %s -o - | FileCheck %s --check-prefix=X32ABI
6
7@g_int = global i32 0, align 4
8
9; Function Attrs: noinline nounwind optnone uwtable
10define i32* @test_global_ptrv() #3 {
11; X64-LABEL: test_global_ptrv:
12; X64:       # %bb.0: # %entry
13; X64-NEXT:    leaq g_int, %rax
14; X64-NEXT:    retq
15;
16; X64_DARWIN_PIC-LABEL: test_global_ptrv:
17; X64_DARWIN_PIC:       ## %bb.0: ## %entry
18; X64_DARWIN_PIC-NEXT:    leaq _g_int(%rip), %rax
19; X64_DARWIN_PIC-NEXT:    retq
20;
21; X32-LABEL: test_global_ptrv:
22; X32:       # %bb.0: # %entry
23; X32-NEXT:    leal g_int, %eax
24; X32-NEXT:    retl
25;
26; X32ABI-LABEL: test_global_ptrv:
27; X32ABI:       # %bb.0: # %entry
28; X32ABI-NEXT:    leal g_int, %eax
29; X32ABI-NEXT:    retq
30entry:
31  ret i32* @g_int
32}
33
34; Function Attrs: noinline nounwind optnone uwtable
35define i32 @test_global_valv() #3 {
36; X64-LABEL: test_global_valv:
37; X64:       # %bb.0: # %entry
38; X64-NEXT:    leaq g_int, %rax
39; X64-NEXT:    movl (%rax), %eax
40; X64-NEXT:    retq
41;
42; X64_DARWIN_PIC-LABEL: test_global_valv:
43; X64_DARWIN_PIC:       ## %bb.0: ## %entry
44; X64_DARWIN_PIC-NEXT:    leaq _g_int(%rip), %rax
45; X64_DARWIN_PIC-NEXT:    movl (%rax), %eax
46; X64_DARWIN_PIC-NEXT:    retq
47;
48; X32-LABEL: test_global_valv:
49; X32:       # %bb.0: # %entry
50; X32-NEXT:    leal g_int, %eax
51; X32-NEXT:    movl (%eax), %eax
52; X32-NEXT:    retl
53;
54; X32ABI-LABEL: test_global_valv:
55; X32ABI:       # %bb.0: # %entry
56; X32ABI-NEXT:    leal g_int, %eax
57; X32ABI-NEXT:    movl (%eax), %eax
58; X32ABI-NEXT:    retq
59entry:
60  %0 = load i32, i32* @g_int, align 4
61  ret i32 %0
62}
63
64