[MachineScheduler] Fix physreg dependencies of ExitSU (#123541)
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / cndmask-no-def-vcc.ll
blobede57f1a0a04ce32fcfb9f89bbd4415037aebf03
1 ; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 declare i1 @llvm.amdgcn.class.f32(float, i32)
5 ; Produces error after adding an implicit def to v_cndmask_b32
7 ; GCN-LABEL: {{^}}vcc_shrink_vcc_def:
8 ; GCN: s_cmp_eq_u32 s{{[0-9]+}}, 0{{$}}
9 ; GCN: s_cselect_b64 vcc, -1, 0
10 ; GCN: v_cndmask_b32_e32 v{{[0-9]+}}, 1.0, v{{[0-9]+}}, vcc
11 define amdgpu_kernel void @vcc_shrink_vcc_def(float %arg, i32 %arg1, float %arg2, i32 %arg3) {
12 bb0:
13   %tmp = icmp sgt i32 %arg1, 4
14   %c = icmp eq i32 %arg3, 0
15   %tmp4 = select i1 %c, float %arg, float 1.000000e+00
16   %tmp5 = fcmp ogt float %arg2, 0.000000e+00
17   %tmp6 = fcmp olt float %arg2, 1.000000e+00
18   %tmp7 = fcmp olt float %arg, %tmp4
19   %tmp8 = and i1 %tmp5, %tmp6
20   %tmp9 = and i1 %tmp8, %tmp7
21   br i1 %tmp9, label %bb1, label %bb2
23 bb1:
24   store volatile i32 0, ptr addrspace(1) undef
25   br label %bb2
27 bb2:
28   ret void
31 ; The undef flag on the condition src must be preserved on the
32 ; implicit vcc use to avoid verifier errors.
34 ; GCN-LABEL: {{^}}preserve_condition_undef_flag:
35 ; GCN-NOT: vcc
36 ; GCN: s_endpgm
37 define amdgpu_kernel void @preserve_condition_undef_flag(float %arg, i32 %arg1, float %arg2) {
38 bb0:
39   %tmp = icmp sgt i32 %arg1, 4
40   %undef = call i1 @llvm.amdgcn.class.f32(float undef, i32 undef)
41   %tmp4 = select i1 %undef, float %arg, float 1.000000e+00
42   %tmp5 = fcmp ogt float %arg2, 0.000000e+00
43   %tmp6 = fcmp olt float %arg2, 1.000000e+00
44   %tmp7 = fcmp olt float %arg, undef
45   %tmp8 = and i1 %tmp5, %tmp6
46   %tmp9 = and i1 %tmp8, %tmp7
47   br i1 %tmp9, label %bb1, label %bb2
49 bb1:
50   store volatile i32 0, ptr addrspace(1) undef
51   br label %bb2
53 bb2:
54   ret void