Skip to content

Commit 68421be

Browse files
RKSimonvinay-deshmukh
authored andcommitted
[X86] isGuaranteedNotToBeUndefOrPoison - add simple target shuffles with known test coverage (llvm#161553)
Add a number of simple target shuffles (fixed shuffle mask or simple immediate control) to isGuaranteedNotToBeUndefOrPoison/canCreateUndefOrPoisonForTargetNode that have known test coverage and obviously don't introduce undef/poison. These were found by adding an assert for unhandled target shuffles and running over CodeGen/X86 - providing explicit test coverage is incredibly difficult as ISD::VECTOR_SHUFFLE nodes will typically handle freeze nodes before we lower to these target shuffle nodes.
1 parent c7dc48a commit 68421be

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45022,11 +45022,16 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
4502245022
case X86ISD::INSERTPS:
4502345023
case X86ISD::BLENDI:
4502445024
case X86ISD::PSHUFB:
45025+
case X86ISD::VZEXT_MOVL:
4502545026
case X86ISD::PSHUFD:
45027+
case X86ISD::PSHUFHW:
45028+
case X86ISD::PSHUFLW:
45029+
case X86ISD::SHUFP:
4502645030
case X86ISD::UNPCKL:
4502745031
case X86ISD::UNPCKH:
4502845032
case X86ISD::VPERMILPV:
4502945033
case X86ISD::VPERMILPI:
45034+
case X86ISD::VPERMI:
4503045035
case X86ISD::VPERMV:
4503145036
case X86ISD::VPERMV3: {
4503245037
SmallVector<int, 8> Mask;
@@ -45052,6 +45057,16 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
4505245057
}
4505345058
break;
4505445059
}
45060+
case X86ISD::VBROADCAST: {
45061+
SDValue Src = Op.getOperand(0);
45062+
MVT SrcVT = Src.getSimpleValueType();
45063+
if (SrcVT.isVector()) {
45064+
APInt DemandedSrc = APInt::getOneBitSet(SrcVT.getVectorNumElements(), 0);
45065+
return DAG.isGuaranteedNotToBeUndefOrPoison(Src, DemandedSrc, PoisonOnly,
45066+
Depth + 1);
45067+
}
45068+
return DAG.isGuaranteedNotToBeUndefOrPoison(Src, PoisonOnly, Depth + 1);
45069+
}
4505545070
}
4505645071
return TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
4505745072
Op, DemandedElts, DAG, PoisonOnly, Depth);
@@ -45096,13 +45111,19 @@ bool X86TargetLowering::canCreateUndefOrPoisonForTargetNode(
4509645111
// SSE target shuffles.
4509745112
case X86ISD::INSERTPS:
4509845113
case X86ISD::PSHUFB:
45114+
case X86ISD::VZEXT_MOVL:
4509945115
case X86ISD::PSHUFD:
45116+
case X86ISD::PSHUFHW:
45117+
case X86ISD::PSHUFLW:
45118+
case X86ISD::SHUFP:
4510045119
case X86ISD::UNPCKL:
4510145120
case X86ISD::UNPCKH:
4510245121
case X86ISD::VPERMILPV:
4510345122
case X86ISD::VPERMILPI:
45123+
case X86ISD::VPERMI:
4510445124
case X86ISD::VPERMV:
4510545125
case X86ISD::VPERMV3:
45126+
case X86ISD::VBROADCAST:
4510645127
return false;
4510745128
// SSE comparisons handle all icmp/fcmp cases.
4510845129
// TODO: Add CMPM/MM with test coverage.

0 commit comments

Comments
 (0)