Skip to content

Commit e8f31cf

Browse files
committed
[X86] canCreateUndefOrPoisonForTargetNode/isGuaranteedNotToBeUndefOrPoisonForTargetNode - add X86ISD::VPERMILPV handling
X86ISD::PSHUFB shuffles can't create undef/poison itself, allowing us to fold freeze(vpermilps(x,y)) -> vpermilps(freeze(x),freeze(y))
1 parent c731291 commit e8f31cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45188,6 +45188,7 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
4518845188
case X86ISD::PSHUFD:
4518945189
case X86ISD::UNPCKL:
4519045190
case X86ISD::UNPCKH:
45191+
case X86ISD::VPERMILPV:
4519145192
case X86ISD::VPERMILPI:
4519245193
case X86ISD::VPERMV3: {
4519345194
SmallVector<int, 8> Mask;
@@ -45254,6 +45255,7 @@ bool X86TargetLowering::canCreateUndefOrPoisonForTargetNode(
4525445255
case X86ISD::PSHUFD:
4525545256
case X86ISD::UNPCKL:
4525645257
case X86ISD::UNPCKH:
45258+
case X86ISD::VPERMILPV:
4525745259
case X86ISD::VPERMILPI:
4525845260
case X86ISD::VPERMV3:
4525945261
return false;

llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,6 @@ define <8 x float> @constant_fold_vpermilvar_ps_256() {
373373
define <8 x float> @freeze_vpermilvar_ps_256(<8 x float> %a0) {
374374
; CHECK-LABEL: freeze_vpermilvar_ps_256:
375375
; CHECK: # %bb.0:
376-
; CHECK-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[0,3,1,2,7,6,5,4]
377-
; CHECK-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[0,2,3,1,7,6,5,4]
378376
; CHECK-NEXT: ret{{[l|q]}}
379377
%s0 = call <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float> %a0, <8 x i32> <i32 0, i32 3, i32 1, i32 2, i32 7, i32 6, i32 5, i32 4>)
380378
%f0 = freeze <8 x float> %s0

0 commit comments

Comments
 (0)