142 lines · plain
1; Note: uses a randomly selected assumed external call stack size so that the2; test assertions are unlikely to succeed by accident.3 4; RUN: llc -amdgpu-assume-external-call-stack-size=5310 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -enable-misched=0 -filetype=asm -o - < %s | FileCheck --check-prefixes CHECK,GFX7 %s5; RUN: llc -amdgpu-assume-external-call-stack-size=5310 -mattr=-xnack -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -enable-misched=0 -filetype=asm -o - < %s | FileCheck --check-prefixes CHECK,GFX8 %s6; RUN: llc -amdgpu-assume-external-call-stack-size=5310 -mattr=-xnack -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -enable-misched=0 -filetype=asm -o - < %s | FileCheck --check-prefixes CHECK,GFX9 %s7; RUN: llc -amdgpu-assume-external-call-stack-size=5310 -mattr=-xnack -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -enable-misched=0 -filetype=asm -o - < %s | FileCheck --check-prefixes CHECK,GFX10 %s8 9; CHECK-LABEL: amdhsa.kernels10 11; test a kernel without an external call that occurs before its callee in the module12; CHECK-LABEL: test113; CHECK: .private_segment_fixed_size: 2014 15; GFX7: .sgpr_count: 3716; GFX7: .sgpr_spill_count: 017; GFX7: .vgpr_count: 418; GFX7: .vgpr_spill_count: 019 20; GFX8: .sgpr_count: 3921; GFX8: .sgpr_spill_count: 022; GFX8: .vgpr_count: 423; GFX8: .vgpr_spill_count: 024 25; GFX9: .sgpr_count: 3926; GFX9: .sgpr_spill_count: 027; GFX9: .vgpr_count: 428; GFX9: .vgpr_spill_count: 029 30; GFX10: .sgpr_count: 3331; GFX10: .sgpr_spill_count: 032; GFX10: .vgpr_count: 433; GFX10: .vgpr_spill_count: 034define amdgpu_kernel void @test1(ptr %x) #1 {35 %1 = load volatile float, ptr %x36 %2 = call float @f(float %1)37 store volatile float %2, ptr %x38 ret void39}40 41define internal float @f(float %arg0) #1 {42 %stack = alloca float, i32 4, align 4, addrspace(5)43 store volatile float 3.0, ptr addrspace(5) %stack44 %val = load volatile float, ptr addrspace(5) %stack45 %add = fadd float %arg0, %val46 ret float %add47}48 49; test a kernel without an external call that occurs after its callee in the module50; CHECK-LABEL: test251; CHECK: .private_segment_fixed_size: 2052 53; GFX7: .sgpr_count: 3754; GFX7: .sgpr_spill_count: 055; GFX7: .vgpr_count: 456; GFX7: .vgpr_spill_count: 057 58; GFX8: .sgpr_count: 3959; GFX8: .sgpr_spill_count: 060; GFX8: .vgpr_count: 461; GFX8: .vgpr_spill_count: 062 63; GFX9: .sgpr_count: 3964; GFX9: .sgpr_spill_count: 065; GFX9: .vgpr_count: 466; GFX9: .vgpr_spill_count: 067 68; GFX10: .sgpr_count: 3369; GFX10: .sgpr_spill_count: 070; GFX10: .vgpr_count: 471; GFX10: .vgpr_spill_count: 072define amdgpu_kernel void @test2(ptr %x) {73 %1 = load volatile float, ptr %x74 %2 = call float @f(float %1)75 store volatile float %2, ptr %x76 ret void77}78 79; test a kernel with an external call that occurs before its callee in the module80; CHECK-LABEL: test381; CHECK: .private_segment_fixed_size: 531082 83; GFX7: .sgpr_count: 3784; GFX7: .sgpr_spill_count: 085; GFX7: .vgpr_count: 3286; GFX7: .vgpr_spill_count: 087 88; GFX8: .sgpr_count: 3989; GFX8: .sgpr_spill_count: 090; GFX8: .vgpr_count: 3291; GFX8: .vgpr_spill_count: 092 93; GFX9: .sgpr_count: 3994; GFX9: .sgpr_spill_count: 095; GFX9: .vgpr_count: 3296; GFX9: .vgpr_spill_count: 097 98; GFX10: .sgpr_count: 3599; GFX10: .sgpr_spill_count: 0100; GFX10: .vgpr_count: 32101; GFX10: .vgpr_spill_count: 0102define amdgpu_kernel void @test3() {103 call void @g()104 ret void105}106 107declare void @g() #0108 109; test a kernel without an external call that occurs after its callee in the module110; CHECK-LABEL: test4111; CHECK: .private_segment_fixed_size: 5310112 113; GFX7: .sgpr_count: 37114; GFX7: .sgpr_spill_count: 0115; GFX7: .vgpr_count: 32116; GFX7: .vgpr_spill_count: 0117 118; GFX8: .sgpr_count: 39119; GFX8: .sgpr_spill_count: 0120; GFX8: .vgpr_count: 32121; GFX8: .vgpr_spill_count: 0122 123; GFX9: .sgpr_count: 39124; GFX9: .sgpr_spill_count: 0125; GFX9: .vgpr_count: 32126; GFX9: .vgpr_spill_count: 0127 128; GFX10: .sgpr_count: 35129; GFX10: .sgpr_spill_count: 0130; GFX10: .vgpr_count: 32131; GFX10: .vgpr_spill_count: 0132define amdgpu_kernel void @test4() {133 call void @g()134 ret void135}136 137attributes #0 = { norecurse }138attributes #1 = { norecurse "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" }139 140!llvm.module.flags = !{!0}141!0 = !{i32 1, !"amdhsa_code_object_version", i32 400}142