xref: /llvm-project/llvm/test/CodeGen/AMDGPU/insert-subvector-unused-scratch.ll (revision bdf2fbba9cee60b4b260ff17e4f44c475c11e715)
1; RUN: llc -mtriple amdgcn-amd-- -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; Before the fix that this test was committed with, this code would leave
4; an unused stack slot, causing ScratchSize to be non-zero.
5
6; GCN-LABEL: store_v3i32:
7; GCN:        ds_read_b96
8; GCN:        ds_write_b96
9; GCN: ScratchSize: 0
10define amdgpu_kernel void @store_v3i32(ptr addrspace(3) %out, <3 x i32> %a) nounwind {
11  %val = load <3 x i32>, ptr addrspace(3) %out
12  %val.1 = add <3 x i32> %a, %val
13  store <3 x i32> %val.1, ptr addrspace(3) %out, align 16
14  ret void
15}
16
17; GCN-LABEL: store_v5i32:
18; GCN:        ds_read_b128
19; GCN:        ds_read_b32
20; GCN:        ds_write_b32
21; GCN:        ds_write_b128
22; GCN: ScratchSize: 0
23define amdgpu_kernel void @store_v5i32(ptr addrspace(3) %out, <5 x i32> %a) nounwind {
24  %val = load <5 x i32>, ptr addrspace(3) %out
25  %val.1 = add <5 x i32> %a, %val
26  store <5 x i32> %val.1, ptr addrspace(3) %out, align 16
27  ret void
28}
29