Skip to content

Commit

Permalink
[X86] canCreateUndefOrPoisonForTargetNode - X86ISD::VPERMV3 shuffles …
Browse files Browse the repository at this point in the history
…don't create undef/poison

The operands might contain an undef/poison element, but the shuffle node itself will not create one by itself.

Improves test case from llvm#109272
  • Loading branch information
RKSimon committed Oct 14, 2024
1 parent fd8a4b0 commit d81c2f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43839,7 +43839,8 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(

switch (Op.getOpcode()) {
case X86ISD::PSHUFD:
case X86ISD::VPERMILPI: {
case X86ISD::VPERMILPI:
case X86ISD::VPERMV3: {
SmallVector<int, 8> Mask;
SmallVector<SDValue, 2> Ops;
if (getTargetShuffleMask(Op, true, Ops, Mask)) {
Expand Down Expand Up @@ -43883,6 +43884,7 @@ bool X86TargetLowering::canCreateUndefOrPoisonForTargetNode(
return false;
case X86ISD::PSHUFD:
case X86ISD::VPERMILPI:
case X86ISD::VPERMV3:
case X86ISD::UNPCKH:
case X86ISD::UNPCKL:
return false;
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/CodeGen/X86/vector-shuffle-combining-avx512vbmi.ll
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ define <64 x i8> @combine_permi2q_pshufb_as_permi2d_mask(<8 x i64> %a0, <8 x i64
define <64 x i8> @combine_vpermi2var_v64i8_with_mask(<64 x i8> %a0, <64 x i8> %a1, <64 x i8> %a2) {
; CHECK-LABEL: combine_vpermi2var_v64i8_with_mask:
; CHECK: # %bb.0:
; CHECK-NEXT: vpermt2b %zmm2, %zmm1, %zmm0
; CHECK-NEXT: vpmovb2m %zmm1, %k0
; CHECK-NEXT: knotq %k0, %k1
; CHECK-NEXT: vmovdqu8 %zmm0, %zmm0 {%k1} {z}
; CHECK-NEXT: vpermt2b %zmm2, %zmm1, %zmm0 {%k1} {z}
; CHECK-NEXT: ret{{[l|q]}}
%perm = tail call <64 x i8> @llvm.x86.avx512.vpermi2var.qi.512(<64 x i8> %a0, <64 x i8> %a1, <64 x i8> %a2)
%cmp = icmp slt <64 x i8> %a1, zeroinitializer
Expand Down

0 comments on commit d81c2f1

Please sign in to comment.