[MachineScheduler] Fix physreg dependencies of ExitSU (#123541)
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / dag-divergence.ll
blobdfc28539ea814cc7161865ca18b17550f105b455
1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: {{^}}private_load_maybe_divergent:
4 ; GCN: buffer_load_dword
5 ; GCN-NOT: s_load_dword s
6 ; GCN: flat_load_dword
7 ; GCN-NOT: s_load_dword s
8 define amdgpu_kernel void @private_load_maybe_divergent(ptr addrspace(4) %k, ptr %flat) {
9   %load = load volatile i32, ptr addrspace(5) undef, align 4
10   %gep = getelementptr inbounds i32, ptr addrspace(4) %k, i32 %load
11   %maybe.not.uniform.load = load i32, ptr addrspace(4) %gep, align 4
12   store i32 %maybe.not.uniform.load, ptr addrspace(1) undef
13   ret void
16 ; GCN-LABEL: {{^}}flat_load_maybe_divergent:
17 ; GCN: s_load_dwordx4
18 ; GCN-NOT: s_load
19 ; GCN: flat_load_dword
20 ; GCN-NOT: s_load
21 ; GCN: flat_load_dword
22 ; GCN-NOT: s_load
23 ; GCN: flat_store_dword
24 define amdgpu_kernel void @flat_load_maybe_divergent(ptr addrspace(4) %k, ptr %flat) {
25   %load = load i32, ptr %flat, align 4
26   %gep = getelementptr inbounds i32, ptr addrspace(4) %k, i32 %load
27   %maybe.not.uniform.load = load i32, ptr addrspace(4) %gep, align 4
28   store i32 %maybe.not.uniform.load, ptr addrspace(1) undef
29   ret void
32 ; This decomposes into a sequence of divergent sub carries. The first
33 ; subs in the sequence are divergent from the value inputs, but the
34 ; last values are divergent due to the carry in glue (such that
35 ; divergence needs to propagate through glue if there are any non-void
36 ; outputs)
37 ; GCN-LABEL: {{^}}wide_carry_divergence_error:
38 ; GCN: v_sub_u32_e32
39 ; GCN: v_subb_u32_e32
40 ; GCN: v_subbrev_u32_e32
41 ; GCN: v_subbrev_u32_e32
42 define <2 x i128> @wide_carry_divergence_error(i128 %arg) {
43   %i = call i128 @llvm.ctlz.i128(i128 %arg, i1 false)
44   %i1 = sub i128 0, %i
45   %i2 = insertelement <2 x i128> zeroinitializer, i128 %i1, i64 0
46   ret <2 x i128> %i2