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: brcond_si_if_xor_0)
9 # 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: brcond_si_if_or_neg1)
10 # 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: brcond_si_if_negated_multi_use)
14 name: brcond_si_if_different_block
18 liveins: $vgpr0, $vgpr1
19 %0:_(s32) = COPY $vgpr0
20 %1:_(s32) = COPY $vgpr1
21 %2:_(s1) = G_ICMP intpred(ne), %0, %1
22 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
30 name: si_if_not_brcond_user
33 liveins: $vgpr0, $vgpr1
34 %0:_(s32) = COPY $vgpr0
35 %1:_(s32) = COPY $vgpr1
36 %2:_(s1) = G_ICMP intpred(ne), %0, %1
37 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
38 %5:_(s32) = G_SELECT %3, %0, %1
39 S_ENDPGM 0, implicit %5
44 name: si_if_multi_user
47 liveins: $vgpr0, $vgpr1
48 %0:_(s32) = COPY $vgpr0
49 %1:_(s32) = COPY $vgpr1
50 %2:_(s1) = G_ICMP intpred(ne), %0, %1
51 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
52 %5:_(s32) = G_SELECT %3, %0, %1
56 S_ENDPGM 0, implicit %5
60 # Make sure we only match G_XOR (if), -1
62 name: brcond_si_if_xor_0
66 liveins: $vgpr0, $vgpr1
67 %0:_(s32) = COPY $vgpr0
68 %1:_(s32) = COPY $vgpr1
69 %2:_(s1) = G_ICMP intpred(ne), %0, %1
70 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
71 %5:_(s1) = G_CONSTANT i1 false
72 %6:_(s1) = G_XOR %3, %5
86 # Make sure we only match G_XOR (if), -1
88 name: brcond_si_if_or_neg1
92 liveins: $vgpr0, $vgpr1
93 %0:_(s32) = COPY $vgpr0
94 %1:_(s32) = COPY $vgpr1
95 %2:_(s1) = G_ICMP intpred(ne), %0, %1
96 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
97 %5:_(s1) = G_CONSTANT i1 true
98 %6:_(s1) = G_OR %3, %5
113 name: brcond_si_if_negated_multi_use
117 liveins: $vgpr0, $vgpr1
118 %0:_(s32) = COPY $vgpr0
119 %1:_(s32) = COPY $vgpr1
120 %2:_(s1) = G_ICMP intpred(ne), %0, %1
121 %3:_(s1), %4:_(s64) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.if), %2
122 %5:_(s1) = G_CONSTANT i1 true
123 %6:_(s1) = G_XOR %3, %5