1 ; RUN: llc --relocation-model=static < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 @global = external dso_local global i32
7 declare dso_local void @func()
9 define ptr @global_addr() #0 {
10 ; CHECK-LABEL: global_addr:
11 ; CHECK: movq global@GOTPCREL_NORELAX(%rip), %rax
17 define i32 @global_load() #0 {
18 ; CHECK-LABEL: global_load:
19 ; CHECK: movq global@GOTPCREL_NORELAX(%rip), [[REG:%r[0-9a-z]+]]
20 ; CHECK: movl ([[REG]]), %eax
23 %load = load i32, ptr @global
27 define void @global_store() #0 {
28 ; CHECK-LABEL: global_store:
29 ; CHECK: movq global@GOTPCREL_NORELAX(%rip), [[REG:%r[0-9a-z]+]]
30 ; CHECK: movl $0, ([[REG]])
33 store i32 0, ptr @global
37 define ptr @func_addr() #0 {
38 ; CHECK-LABEL: func_addr:
39 ; CHECK: movl $func, %eax
45 ; Jump tables shouldn't go through the GOT.
46 define i32 @jump_table(i32 %x) #0 {
47 ; CHECK-LABEL: jump_table:
50 switch i32 %x, label %default [
68 attributes #0 = { "target-features"="+tagged-globals" }