Recommit r310809 with a fix for the spill problem
[llvm-core.git] / test / CodeGen / AMDGPU / spill-to-smem-m0.ll
blobc6691e7bb2f84d8e99ea4860ad54dc7b72321a56
1 ; RUN: llc -O0 -march=amdgcn -mcpu=fiji -amdgpu-spill-sgpr-to-smem=1 -verify-machineinstrs -stop-before=prologepilog < %s
3 ; Spill to SMEM clobbers M0. Check that the implicit-def dead operand is present
4 ; in the pseudo instructions.
6 ; CHECK-LABEL: {{^}}spill_sgpr:
7 ; CHECK: SI_SPILL_S32_SAVE {{.*}}, implicit-def dead %m0
8 ; CHECK: SI_SPILL_S32_RESTORE {{.*}}, implicit-def dead %m0
9 define amdgpu_kernel void @spill_sgpr(i32 addrspace(1)* %out, i32 %in) #0 {
10   %sgpr = call i32  asm sideeffect "; def $0", "=s" () #0
11   %cmp = icmp eq i32 %in, 0
12   br i1 %cmp, label %bb0, label %ret
14 bb0:
15   call void asm sideeffect "; use $0", "s"(i32 %sgpr) #0
16   br label %ret
18 ret:
19   ret void
22 attributes #0 = { nounwind }