1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
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-prefixes=AKF_GCN %s
4 ; RUN: opt -S -mtriple=amdgcn-amd-amdpal -passes=amdgpu-attributor %s | FileCheck -check-prefixes=ATTRIBUTOR_GCN %s
6 ; Check that it doesn't crash
7 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck -check-prefixes=GFX9 %s
8 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 < %s | FileCheck -check-prefixes=GFX10 %s
9 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -global-isel < %s | FileCheck -check-prefixes=GFX10 %s
11 target datalayout = "A5"
14 define amdgpu_cs void @test_simple_indirect_call() {
15 ; AKF_GCN-LABEL: define {{[^@]+}}@test_simple_indirect_call() {
16 ; AKF_GCN-NEXT: [[PC:%.*]] = call i64 @llvm.amdgcn.s.getpc()
17 ; AKF_GCN-NEXT: [[FUN:%.*]] = inttoptr i64 [[PC]] to ptr
18 ; AKF_GCN-NEXT: call amdgpu_gfx void [[FUN]]()
19 ; AKF_GCN-NEXT: ret void
21 ; ATTRIBUTOR_GCN-LABEL: define {{[^@]+}}@test_simple_indirect_call
22 ; ATTRIBUTOR_GCN-SAME: () #[[ATTR0:[0-9]+]] {
23 ; ATTRIBUTOR_GCN-NEXT: [[PC:%.*]] = call i64 @llvm.amdgcn.s.getpc()
24 ; ATTRIBUTOR_GCN-NEXT: [[FUN:%.*]] = inttoptr i64 [[PC]] to ptr
25 ; ATTRIBUTOR_GCN-NEXT: call amdgpu_gfx void [[FUN]]()
26 ; ATTRIBUTOR_GCN-NEXT: ret void
28 ; Attributor adds work-group-size attribute. This should be ok.
29 ; GFX9-LABEL: test_simple_indirect_call:
31 ; GFX9-NEXT: s_getpc_b64 s[8:9]
32 ; GFX9-NEXT: s_mov_b32 s8, s0
33 ; GFX9-NEXT: s_load_dwordx4 s[8:11], s[8:9], 0x10
34 ; GFX9-NEXT: s_getpc_b64 s[4:5]
35 ; GFX9-NEXT: s_mov_b32 s32, 0
36 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
37 ; GFX9-NEXT: s_add_u32 s8, s8, s0
38 ; GFX9-NEXT: s_addc_u32 s9, s9, 0
39 ; GFX9-NEXT: s_mov_b64 s[0:1], s[8:9]
40 ; GFX9-NEXT: s_mov_b64 s[2:3], s[10:11]
41 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
43 ; GFX10-LABEL: test_simple_indirect_call:
45 ; GFX10-NEXT: s_getpc_b64 s[8:9]
46 ; GFX10-NEXT: s_mov_b32 s8, s0
47 ; GFX10-NEXT: s_getpc_b64 s[4:5]
48 ; GFX10-NEXT: s_load_dwordx4 s[8:11], s[8:9], 0x10
49 ; GFX10-NEXT: s_mov_b32 s32, 0
50 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
51 ; GFX10-NEXT: s_bitset0_b32 s11, 21
52 ; GFX10-NEXT: s_add_u32 s8, s8, s0
53 ; GFX10-NEXT: s_addc_u32 s9, s9, 0
54 ; GFX10-NEXT: s_mov_b64 s[0:1], s[8:9]
55 ; GFX10-NEXT: s_mov_b64 s[2:3], s[10:11]
56 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
57 ; GFX10-NEXT: s_endpgm
60 %pc = call i64 @llvm.amdgcn.s.getpc()
61 %fun = inttoptr i64 %pc to ptr
62 call amdgpu_gfx void %fun()
66 ; Function Attrs: nounwind readnone speculatable willreturn
67 declare i64 @llvm.amdgcn.s.getpc() #0
69 attributes #0 = { nounwind readnone speculatable willreturn }
71 ; AKF_GCN: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
73 ; ATTRIBUTOR_GCN: attributes #[[ATTR0]] = { "uniform-work-group-size"="false" }
74 ; ATTRIBUTOR_GCN: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }