64 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals2; Check that no attributes are added to graphics functions3; RUN: opt -S -mtriple=amdgcn-amd-amdpal -passes=amdgpu-attributor %s | FileCheck -check-prefixes=ATTRIBUTOR_GCN %s4 5; Check that it doesn't crash6; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck -check-prefixes=GFX9 %s7; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 < %s | FileCheck -check-prefixes=GFX10 %s8; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -global-isel < %s | FileCheck -check-prefixes=GFX10 %s9 10define amdgpu_cs void @test_simple_indirect_call() {11; ATTRIBUTOR_GCN-LABEL: define {{[^@]+}}@test_simple_indirect_call12; ATTRIBUTOR_GCN-SAME: () #[[ATTR0:[0-9]+]] {13; ATTRIBUTOR_GCN-NEXT: [[PC:%.*]] = call i64 @llvm.amdgcn.s.getpc()14; ATTRIBUTOR_GCN-NEXT: [[FUN:%.*]] = inttoptr i64 [[PC]] to ptr15; ATTRIBUTOR_GCN-NEXT: call amdgpu_gfx void [[FUN]]()16; ATTRIBUTOR_GCN-NEXT: ret void17;18; Attributor adds work-group-size attribute. This should be ok.19; GFX9-LABEL: test_simple_indirect_call:20; GFX9: ; %bb.0:21; GFX9-NEXT: s_getpc_b64 s[8:9]22; GFX9-NEXT: s_mov_b32 s8, s023; GFX9-NEXT: s_load_dwordx4 s[8:11], s[8:9], 0x1024; GFX9-NEXT: s_getpc_b64 s[4:5]25; GFX9-NEXT: s_mov_b32 s32, 026; GFX9-NEXT: s_waitcnt lgkmcnt(0)27; GFX9-NEXT: s_add_u32 s8, s8, s028; GFX9-NEXT: s_addc_u32 s9, s9, 029; GFX9-NEXT: s_mov_b64 s[0:1], s[8:9]30; GFX9-NEXT: s_mov_b64 s[2:3], s[10:11]31; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]32; GFX9-NEXT: s_endpgm33; GFX10-LABEL: test_simple_indirect_call:34; GFX10: ; %bb.0:35; GFX10-NEXT: s_getpc_b64 s[8:9]36; GFX10-NEXT: s_mov_b32 s8, s037; GFX10-NEXT: s_getpc_b64 s[4:5]38; GFX10-NEXT: s_load_dwordx4 s[8:11], s[8:9], 0x1039; GFX10-NEXT: s_mov_b32 s32, 040; GFX10-NEXT: s_waitcnt lgkmcnt(0)41; GFX10-NEXT: s_bitset0_b32 s11, 2142; GFX10-NEXT: s_add_u32 s8, s8, s043; GFX10-NEXT: s_addc_u32 s9, s9, 044; GFX10-NEXT: s_mov_b64 s[0:1], s[8:9]45; GFX10-NEXT: s_mov_b64 s[2:3], s[10:11]46; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]47; GFX10-NEXT: s_endpgm48 49 50 %pc = call i64 @llvm.amdgcn.s.getpc()51 %fun = inttoptr i64 %pc to ptr52 call amdgpu_gfx void %fun()53 ret void54}55 56; Function Attrs: nounwind readnone speculatable willreturn57declare i64 @llvm.amdgcn.s.getpc() #058 59attributes #0 = { nounwind readnone speculatable willreturn }60;.61; ATTRIBUTOR_GCN: attributes #[[ATTR0]] = { "uniform-work-group-size"="false" }62; ATTRIBUTOR_GCN: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }63;.64