xref: /llvm-project/llvm/test/CodeGen/AMDGPU/pal-simple-indirect-call.ll (revision 0bb60dbe34e4a934e47a0493832f3384fb09b7db)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; Check that no attributes are added to graphics functions
3; RUN: opt -S -mtriple=amdgcn-amd-amdpal -amdgpu-annotate-kernel-features  %s | FileCheck -check-prefix=GCN %s
4
5; Check that it doesn't crash
6; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck -check-prefixes=GFX9 %s
7; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 < %s | FileCheck -check-prefixes=GFX10 %s
8; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -global-isel < %s | FileCheck -check-prefixes=GFX10 %s
9
10target datalayout = "A5"
11
12define amdgpu_cs void @test_simple_indirect_call() {
13; GCN-LABEL: define amdgpu_cs void @test_simple_indirect_call() {
14; GFX9-LABEL: test_simple_indirect_call:
15; GFX9:       ; %bb.0:
16; GFX9-NEXT:    s_getpc_b64 s[36:37]
17; GFX9-NEXT:    s_mov_b32 s36, s0
18; GFX9-NEXT:    s_load_dwordx4 s[36:39], s[36:37], 0x10
19; GFX9-NEXT:    s_getpc_b64 s[4:5]
20; GFX9-NEXT:    s_mov_b32 s32, 0
21; GFX9-NEXT:    s_waitcnt lgkmcnt(0)
22; GFX9-NEXT:    s_add_u32 s36, s36, s0
23; GFX9-NEXT:    s_addc_u32 s37, s37, 0
24; GFX9-NEXT:    s_mov_b64 s[0:1], s[36:37]
25; GFX9-NEXT:    s_mov_b64 s[2:3], s[38:39]
26; GFX9-NEXT:    s_swappc_b64 s[30:31], s[4:5]
27; GFX9-NEXT:    s_endpgm
28;
29; GFX10-LABEL: test_simple_indirect_call:
30; GFX10:       ; %bb.0:
31; GFX10-NEXT:    s_getpc_b64 s[36:37]
32; GFX10-NEXT:    s_mov_b32 s36, s0
33; GFX10-NEXT:    s_getpc_b64 s[4:5]
34; GFX10-NEXT:    s_load_dwordx4 s[36:39], s[36:37], 0x10
35; GFX10-NEXT:    s_mov_b32 s32, 0
36; GFX10-NEXT:    s_waitcnt lgkmcnt(0)
37; GFX10-NEXT:    s_bitset0_b32 s39, 21
38; GFX10-NEXT:    s_add_u32 s36, s36, s0
39; GFX10-NEXT:    s_addc_u32 s37, s37, 0
40; GFX10-NEXT:    s_mov_b64 s[0:1], s[36:37]
41; GFX10-NEXT:    s_mov_b64 s[2:3], s[38:39]
42; GFX10-NEXT:    s_swappc_b64 s[30:31], s[4:5]
43; GFX10-NEXT:    s_endpgm
44
45
46  %pc = call i64 @llvm.amdgcn.s.getpc()
47  %fun = inttoptr i64 %pc to void()*
48  call amdgpu_gfx void %fun()
49  ret void
50}
51
52; Function Attrs: nounwind readnone speculatable willreturn
53declare i64 @llvm.amdgcn.s.getpc() #0
54
55attributes #0 = { nounwind readnone speculatable willreturn }
56