aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AMDGPU/global-address.ll
blob: 60f4f0c762cf62090960c66c547110eacdcda519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdpal -mcpu=gfx1100 --verify-machineinstrs < %s | FileCheck -check-prefix=GFX11-PAL-SDAG %s
; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdpal -mcpu=gfx1100 --verify-machineinstrs < %s | FileCheck -check-prefix=GFX11-PAL-GISEL %s
; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdpal -mcpu=gfx1250 < %s | FileCheck -check-prefix=GFX1250-PAL %s
; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdpal -mcpu=gfx1250 < %s | FileCheck -check-prefix=GFX1250-PAL %s
; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 --verify-machineinstrs < %s | FileCheck -check-prefix=GFX11-HSA %s
; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 --verify-machineinstrs < %s | FileCheck -check-prefix=GFX11-HSA %s
; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1250 < %s | FileCheck -check-prefix=GFX1250-HSA %s
; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1250 < %s | FileCheck -check-prefix=GFX1250-HSA %s

define amdgpu_kernel void @caller_internal() {
; GFX11-PAL-SDAG-LABEL: caller_internal:
; GFX11-PAL-SDAG:       ; %bb.0:
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s1, internal_func@abs32@hi
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s0, internal_func@abs32@lo
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s32, 0
; GFX11-PAL-SDAG-NEXT:    s_swappc_b64 s[30:31], s[0:1]
; GFX11-PAL-SDAG-NEXT:    s_endpgm
;
; GFX11-PAL-GISEL-LABEL: caller_internal:
; GFX11-PAL-GISEL:       ; %bb.0:
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s0, internal_func@abs32@lo
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s1, internal_func@abs32@hi
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s32, 0
; GFX11-PAL-GISEL-NEXT:    s_swappc_b64 s[30:31], s[0:1]
; GFX11-PAL-GISEL-NEXT:    s_endpgm
;
; GFX1250-PAL-LABEL: caller_internal:
; GFX1250-PAL:       ; %bb.0:
; GFX1250-PAL-NEXT:    s_mov_b64 s[0:1], internal_func@abs64
; GFX1250-PAL-NEXT:    s_mov_b32 s32, 0
; GFX1250-PAL-NEXT:    s_swap_pc_i64 s[30:31], s[0:1]
; GFX1250-PAL-NEXT:    s_endpgm
;
; GFX11-HSA-LABEL: caller_internal:
; GFX11-HSA:       ; %bb.0:
; GFX11-HSA-NEXT:    s_getpc_b64 s[0:1]
; GFX11-HSA-NEXT:    s_add_u32 s0, s0, internal_func@gotpcrel32@lo+4
; GFX11-HSA-NEXT:    s_addc_u32 s1, s1, internal_func@gotpcrel32@hi+12
; GFX11-HSA-NEXT:    s_mov_b32 s32, 0
; GFX11-HSA-NEXT:    s_load_b64 s[0:1], s[0:1], 0x0
; GFX11-HSA-NEXT:    s_waitcnt lgkmcnt(0)
; GFX11-HSA-NEXT:    s_swappc_b64 s[30:31], s[0:1]
; GFX11-HSA-NEXT:    s_endpgm
;
; GFX1250-HSA-LABEL: caller_internal:
; GFX1250-HSA:       ; %bb.0:
; GFX1250-HSA-NEXT:    s_get_pc_i64 s[0:1]
; GFX1250-HSA-NEXT:    s_add_nc_u64 s[0:1], s[0:1], internal_func@gotpcrel+4
; GFX1250-HSA-NEXT:    s_mov_b32 s32, 0
; GFX1250-HSA-NEXT:    s_load_b64 s[0:1], s[0:1], 0x0
; GFX1250-HSA-NEXT:    s_wait_kmcnt 0x0
; GFX1250-HSA-NEXT:    s_swap_pc_i64 s[30:31], s[0:1]
; GFX1250-HSA-NEXT:    s_endpgm
  call amdgpu_gfx void @internal_func()
  ret void
}

define amdgpu_kernel void @caller_exterinal() {
; GFX11-PAL-SDAG-LABEL: caller_exterinal:
; GFX11-PAL-SDAG:       ; %bb.0:
; GFX11-PAL-SDAG-NEXT:    v_mov_b32_e32 v31, v0
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s12, s13
; GFX11-PAL-SDAG-NEXT:    s_mov_b64 s[10:11], s[6:7]
; GFX11-PAL-SDAG-NEXT:    s_mov_b64 s[8:9], s[4:5]
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s17, external_func@abs32@hi
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s16, external_func@abs32@lo
; GFX11-PAL-SDAG-NEXT:    s_mov_b64 s[4:5], s[0:1]
; GFX11-PAL-SDAG-NEXT:    s_mov_b64 s[6:7], s[2:3]
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s13, s14
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s14, s15
; GFX11-PAL-SDAG-NEXT:    s_mov_b32 s32, 0
; GFX11-PAL-SDAG-NEXT:    s_swappc_b64 s[30:31], s[16:17]
; GFX11-PAL-SDAG-NEXT:    s_endpgm
;
; GFX11-PAL-GISEL-LABEL: caller_exterinal:
; GFX11-PAL-GISEL:       ; %bb.0:
; GFX11-PAL-GISEL-NEXT:    v_mov_b32_e32 v31, v0
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s12, s13
; GFX11-PAL-GISEL-NEXT:    s_mov_b64 s[10:11], s[6:7]
; GFX11-PAL-GISEL-NEXT:    s_mov_b64 s[8:9], s[4:5]
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s16, external_func@abs32@lo
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s17, external_func@abs32@hi
; GFX11-PAL-GISEL-NEXT:    s_mov_b64 s[4:5], s[0:1]
; GFX11-PAL-GISEL-NEXT:    s_mov_b64 s[6:7], s[2:3]
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s13, s14
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s14, s15
; GFX11-PAL-GISEL-NEXT:    s_mov_b32 s32, 0
; GFX11-PAL-GISEL-NEXT:    s_swappc_b64 s[30:31], s[16:17]
; GFX11-PAL-GISEL-NEXT:    s_endpgm
;
; GFX1250-PAL-LABEL: caller_exterinal:
; GFX1250-PAL:       ; %bb.0:
; GFX1250-PAL-NEXT:    v_mov_b32_e32 v31, v0
; GFX1250-PAL-NEXT:    s_mov_b64 s[10:11], s[6:7]
; GFX1250-PAL-NEXT:    s_mov_b64 s[8:9], s[4:5]
; GFX1250-PAL-NEXT:    s_mov_b64 s[12:13], external_func@abs64
; GFX1250-PAL-NEXT:    s_mov_b64 s[4:5], s[0:1]
; GFX1250-PAL-NEXT:    s_mov_b64 s[6:7], s[2:3]
; GFX1250-PAL-NEXT:    s_mov_b32 s32, 0
; GFX1250-PAL-NEXT:    s_swap_pc_i64 s[30:31], s[12:13]
; GFX1250-PAL-NEXT:    s_endpgm
;
; GFX11-HSA-LABEL: caller_exterinal:
; GFX11-HSA:       ; %bb.0:
; GFX11-HSA-NEXT:    v_mov_b32_e32 v31, v0
; GFX11-HSA-NEXT:    s_mov_b32 s12, s13
; GFX11-HSA-NEXT:    s_mov_b64 s[10:11], s[6:7]
; GFX11-HSA-NEXT:    s_mov_b64 s[8:9], s[4:5]
; GFX11-HSA-NEXT:    s_getpc_b64 s[16:17]
; GFX11-HSA-NEXT:    s_add_u32 s16, s16, external_func@rel32@lo+4
; GFX11-HSA-NEXT:    s_addc_u32 s17, s17, external_func@rel32@hi+12
; GFX11-HSA-NEXT:    s_mov_b64 s[4:5], s[0:1]
; GFX11-HSA-NEXT:    s_mov_b64 s[6:7], s[2:3]
; GFX11-HSA-NEXT:    s_mov_b32 s13, s14
; GFX11-HSA-NEXT:    s_mov_b32 s14, s15
; GFX11-HSA-NEXT:    s_mov_b32 s32, 0
; GFX11-HSA-NEXT:    s_swappc_b64 s[30:31], s[16:17]
; GFX11-HSA-NEXT:    s_endpgm
;
; GFX1250-HSA-LABEL: caller_exterinal:
; GFX1250-HSA:       ; %bb.0:
; GFX1250-HSA-NEXT:    v_mov_b32_e32 v31, v0
; GFX1250-HSA-NEXT:    s_mov_b64 s[10:11], s[6:7]
; GFX1250-HSA-NEXT:    s_mov_b64 s[8:9], s[4:5]
; GFX1250-HSA-NEXT:    s_get_pc_i64 s[12:13]
; GFX1250-HSA-NEXT:    s_add_nc_u64 s[12:13], s[12:13], external_func@rel64+4
; GFX1250-HSA-NEXT:    s_mov_b64 s[4:5], s[0:1]
; GFX1250-HSA-NEXT:    s_mov_b64 s[6:7], s[2:3]
; GFX1250-HSA-NEXT:    s_mov_b32 s32, 0
; GFX1250-HSA-NEXT:    s_swap_pc_i64 s[30:31], s[12:13]
; GFX1250-HSA-NEXT:    s_endpgm
  call void @external_func()
  ret void
}

declare amdgpu_gfx void @internal_func()
declare hidden void @external_func()