AMDGPU/SI: Add support for shrinking v_cndmask_b32_e32 instructions
[oota-llvm.git] / test / CodeGen / AMDGPU / subreg-coalescer-undef-use.ll
1 ; RUN: llc -march=amdgcn -mcpu=SI -o - %s | FileCheck %s
2 ; Don't crash when the use of an undefined value is only detected by the
3 ; register coalescer because it is hidden with subregister insert/extract.
4 target triple="amdgcn--"
5
6 ; CHECK-LABEL: foobar:
7 ; CHECK: s_load_dword s2, s[0:1], 0x9
8 ; CHECK-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0xb
9 ; CHECK-NEXT: s_waitcnt lgkmcnt(0)
10 ; CHECK-NEXT: v_mov_b32_e32 v0, s2
11 ; CHECK-NEXT: s_and_saveexec_b64 s[2:3], s[0:1]
12 ; CHECK-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
13 ; BB0_1:
14 ; CHECK: s_load_dword s6, s[0:1], 0xa
15 ; CHECK-NEXT: s_waitcnt lgkmcnt(0)
16 ; CHECK-NEXT: v_mov_b32_e32 v0, s6
17 ; BB0_2:
18 ; CHECK: s_or_b64 exec, exec, s[2:3]
19 ; CHECK-NEXT: s_mov_b32 s7, 0xf000
20 ; CHECK-NEXT: s_mov_b32 s6, -1
21 ; CHECK-NEXT: buffer_store_dword v1, s[4:7], 0
22 ; CHECK-NEXT: s_endpgm
23 define void @foobar(float %a0, float %a1, float addrspace(1)* %out) nounwind {
24 entry:
25   %v0 = insertelement <4 x float> undef, float %a0, i32 0
26   br i1 undef, label %ift, label %ife
27
28 ift:
29   %v1 = insertelement <4 x float> undef, float %a1, i32 0
30   br label %ife
31
32 ife:
33   %val = phi <4 x float> [ %v1, %ift ], [ %v0, %entry ]
34   %v2 = extractelement <4 x float> %val, i32 1
35   store float %v2, float addrspace(1)* %out, align 4
36   ret void
37 }