1 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer -global-isel-abort=2 -pass-remarks-missed='gisel*' -o /dev/null %s 2>&1 | FileCheck -check-prefix=ERR %s
3 # Make sure incorrect usage of control flow intrinsics fails to select in case some transform separated the intrinsic from its branch.
5 # ERR: remark: <unknown>:0:0: unable to legalize instruction: %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2:_(s1) (in function: brcond_si_if_different_block)
6 # ERR-NEXT: remark: <unknown>:0:0: unable to legalize instruction: %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2:_(s1) (in function: si_if_not_brcond_user)
7 # ERR-NEXT: remark: <unknown>:0:0: unable to legalize instruction: %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2:_(s1) (in function: si_if_multi_user)
8 # ERR-NEXT: remark: <unknown>:0:0: unable to legalize instruction: %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2:_(s1) (in function: si_if_not_condition)
12 name: brcond_si_if_different_block
16 liveins: $vgpr0, $vgpr1
17 %0:_(s32) = COPY $vgpr0
18 %1:_(s32) = COPY $vgpr1
19 %2:_(s1) = G_ICMP intpred(ne), %0, %1
20 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
28 name: si_if_not_brcond_user
31 liveins: $vgpr0, $vgpr1
32 %0:_(s32) = COPY $vgpr0
33 %1:_(s32) = COPY $vgpr1
34 %2:_(s1) = G_ICMP intpred(ne), %0, %1
35 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
36 %5:_(s32) = G_SELECT %3, %0, %1
37 S_ENDPGM 0, implicit %5
42 name: si_if_multi_user
45 liveins: $vgpr0, $vgpr1
46 %0:_(s32) = COPY $vgpr0
47 %1:_(s32) = COPY $vgpr1
48 %2:_(s1) = G_ICMP intpred(ne), %0, %1
49 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
50 %5:_(s32) = G_SELECT %3, %0, %1
54 S_ENDPGM 0, implicit %5
59 name: si_if_not_condition
62 liveins: $vgpr0, $vgpr1
63 %0:_(s32) = COPY $vgpr0
64 %1:_(s32) = COPY $vgpr1
65 %2:_(s1) = G_ICMP intpred(ne), %0, %1
66 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
67 %5:_(s1) = G_CONSTANT i1 true
68 %6:_(s1) = G_XOR %3, %5