1; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -verify-machineinstrs < %s 2>%t.err | FileCheck %s
2; RUN: FileCheck -check-prefix=ERR %s < %t.err
3
4; This testcase fails register allocation at the same time it performs
5; virtual register splitting (by introducing VGPR to AGPR copies). We
6; still need to enqueue and allocate the newly split vregs after the
7; failure.
8
9
10; ERR: error: ran out of registers during register allocation
11; ERR-NEXT: error: ran out of registers during register allocation
12; ERR-NEXT: error: ran out of registers during register allocation
13; ERR-NOT: ERROR
14
15; CHECK: v_accvgpr_write_b32
16; CHECK: v_accvgpr_write_b32
17; CHECK: v_accvgpr_write_b32
18; CHECK: v_accvgpr_write_b32
19; CHECK: v_accvgpr_write_b32
20; CHECK: v_accvgpr_write_b32
21; CHECK: v_accvgpr_write_b32
22
23; CHECK: v_accvgpr_read_b32
24; CHECK: v_accvgpr_read_b32
25; CHECK: v_accvgpr_read_b32
26; CHECK: v_accvgpr_read_b32
27; CHECK: v_accvgpr_read_b32
28; CHECK: v_accvgpr_read_b32
29; CHECK: v_accvgpr_read_b32
30define amdgpu_kernel void @alloc_failure_with_split_vregs(float %v0, float %v1) #0 {
31  %agpr0 = call float asm sideeffect "; def $0", "=${a0}"()
32  %agpr.vec = insertelement <16 x float> undef, float %agpr0, i32 0
33  %mfma0 = call <16 x float> @llvm.amdgcn.mfma.f32.16x16x1f32(float %v0, float %v1, <16 x float> %agpr.vec, i32 0, i32 0, i32 0)
34  %mfma0.3 = extractelement <16 x float> %mfma0, i32 3
35  %insert = insertelement <16 x float> %mfma0, float %agpr0, i32 8
36  %mfma1 = call <16 x float> @llvm.amdgcn.mfma.f32.16x16x1f32(float %v0, float %v1, <16 x float> %insert, i32 0, i32 0, i32 0)
37  %mfma1.3 = extractelement <16 x float> %mfma1, i32 3
38  call void asm sideeffect "; use $0", "{a1}"(float %mfma1.3)
39  ret void
40}
41
42declare <16 x float> @llvm.amdgcn.mfma.f32.16x16x1f32(float, float, <16 x float>, i32 immarg, i32 immarg, i32 immarg) #1
43declare i32 @llvm.amdgcn.workitem.id.x() #2
44
45attributes #0 = { "amdgpu-waves-per-eu"="10,10" }
46attributes #1 = { convergent nounwind readnone willreturn }
47attributes #2 = { nounwind readnone speculatable willreturn }
48