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
9target datalayout = "A5"
10
11define amdgpu_cs void @test_simple_indirect_call() {
12; GCN-LABEL: define amdgpu_cs void @test_simple_indirect_call() {
13; GFX9-LABEL: test_simple_indirect_call:
14; GFX9:       ; %bb.0:
15; GFX9-NEXT:    s_getpc_b64 s[36:37]
16; GFX9-NEXT:    s_mov_b32 s36, s0
17; GFX9-NEXT:    s_load_dwordx4 s[36:39], s[36:37], 0x10
18; GFX9-NEXT:    s_getpc_b64 s[4:5]
19; GFX9-NEXT:    s_mov_b32 s32, 0
20; GFX9-NEXT:    s_waitcnt lgkmcnt(0)
21; GFX9-NEXT:    s_add_u32 s36, s36, s0
22; GFX9-NEXT:    s_addc_u32 s37, s37, 0
23; GFX9-NEXT:    s_mov_b64 s[0:1], s[36:37]
24; GFX9-NEXT:    s_mov_b64 s[2:3], s[38:39]
25; GFX9-NEXT:    s_swappc_b64 s[30:31], s[4:5]
26; GFX9-NEXT:    s_endpgm
27;
28; GFX10-LABEL: test_simple_indirect_call:
29; GFX10:       ; %bb.0:
30; GFX10-NEXT:    s_getpc_b64 s[36:37]
31; GFX10-NEXT:    s_mov_b32 s36, s0
32; GFX10-NEXT:    s_getpc_b64 s[4:5]
33; GFX10-NEXT:    s_load_dwordx4 s[36:39], s[36:37], 0x10
34; GFX10-NEXT:    s_mov_b32 s32, 0
35; GFX10-NEXT:    s_waitcnt lgkmcnt(0)
36; GFX10-NEXT:    s_bitset0_b32 s39, 21
37; GFX10-NEXT:    s_add_u32 s36, s36, s0
38; GFX10-NEXT:    s_addc_u32 s37, s37, 0
39; GFX10-NEXT:    s_mov_b64 s[0:1], s[36:37]
40; GFX10-NEXT:    s_mov_b64 s[2:3], s[38:39]
41; GFX10-NEXT:    s_swappc_b64 s[30:31], s[4:5]
42; GFX10-NEXT:    s_endpgm
43
44
45  %pc = call i64 @llvm.amdgcn.s.getpc()
46  %fun = inttoptr i64 %pc to void()*
47  call amdgpu_gfx void %fun()
48  ret void
49}
50
51; Function Attrs: nounwind readnone speculatable willreturn
52declare i64 @llvm.amdgcn.s.getpc() #0
53
54attributes #0 = { nounwind readnone speculatable willreturn }
55