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 flat_scratch_lo, s5
7; GCN: s_add_u32 s4, s4, s7
8; GCN: s_lshr_b32
9; GCN: s_endpgm
10define amdgpu_kernel void @test_call_undef() #0 {
11  %val = call i32 undef(i32 1)
12  %op = add i32 %val, 1
13  store volatile i32 %op, i32 addrspace(1)* undef
14  ret void
15}
16
17; GCN-LABEL: {{^}}test_tail_call_undef:
18; GCN: s_waitcnt
19; GCN-NEXT: .Lfunc_end
20define i32 @test_tail_call_undef() #0 {
21  %call = tail call i32 undef(i32 1)
22  ret i32 %call
23}
24
25; GCN-LABEL: {{^}}test_call_null:
26; GCN: s_mov_b32 flat_scratch_lo, s5
27; GCN: s_add_u32 s4, s4, s7
28; GCN: s_lshr_b32
29; GCN: s_endpgm
30define amdgpu_kernel void @test_call_null() #0 {
31  %val = call i32 null(i32 1)
32  %op = add i32 %val, 1
33  store volatile i32 %op, i32 addrspace(1)* null
34  ret void
35}
36
37; GCN-LABEL: {{^}}test_tail_call_null:
38; GCN: s_waitcnt
39; GCN-NEXT: .Lfunc_end
40define i32 @test_tail_call_null() #0 {
41  %call = tail call i32 null(i32 1)
42  ret i32 %call
43}
44