1; RUN: llc -mtriple=amdgcn-amd-amdhsa < %s | FileCheck -check-prefix=GCN %s
2
3; FIXME: Emitting unnecessary flat_scratch setup
4
5; GCN-LABEL: {{^}}test_call_undef:
6; GCN: s_mov_b32 s8, s7
7; GCN: s_mov_b32 flat_scratch_lo, s5
8; GCN: s_add_u32 s4, s4, s8
9; GCN: s_lshr_b32
10; GCN: s_endpgm
11define amdgpu_kernel void @test_call_undef() #0 {
12  %val = call i32 undef(i32 1)
13  %op = add i32 %val, 1
14  store volatile i32 %op, i32 addrspace(1)* undef
15  ret void
16}
17
18; GCN-LABEL: {{^}}test_tail_call_undef:
19; GCN: s_waitcnt
20; GCN-NEXT: .Lfunc_end
21define i32 @test_tail_call_undef() #0 {
22  %call = tail call i32 undef(i32 1)
23  ret i32 %call
24}
25
26; GCN-LABEL: {{^}}test_call_null:
27; GCN: s_mov_b32 s8, s7
28; GCN: s_mov_b32 flat_scratch_lo, s5
29; GCN: s_add_u32 s4, s4, s8
30; GCN: s_lshr_b32
31; GCN: s_endpgm
32define amdgpu_kernel void @test_call_null() #0 {
33  %val = call i32 null(i32 1)
34  %op = add i32 %val, 1
35  store volatile i32 %op, i32 addrspace(1)* null
36  ret void
37}
38
39; GCN-LABEL: {{^}}test_tail_call_null:
40; GCN: s_waitcnt
41; GCN-NEXT: .Lfunc_end
42define i32 @test_tail_call_null() #0 {
43  %call = tail call i32 null(i32 1)
44  ret i32 %call
45}
46