[llvm] r374878 - [X86] Resolve KnownUndef/KnownZero bits into target shuffle masks in helper. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 04:13:52 PDT 2019
Author: rksimon
Date: Tue Oct 15 04:13:51 2019
New Revision: 374878
URL: http://llvm.org/viewvc/llvm-project?rev=374878&view=rev
Log:
[X86] Resolve KnownUndef/KnownZero bits into target shuffle masks in helper. NFCI.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=374878&r1=374877&r2=374878&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 15 04:13:51 2019
@@ -6807,6 +6807,22 @@ static bool getTargetShuffleAndZeroables
return true;
}
+// Replace target shuffle mask elements with known undef/zero sentinels.
+static void resolveTargetShuffleAndZeroables(SmallVectorImpl<int> &Mask,
+ const APInt &KnownUndef,
+ const APInt &KnownZero) {
+ unsigned NumElts = Mask.size();
+ assert(KnownUndef.getBitWidth() == NumElts &&
+ KnownZero.getBitWidth() == NumElts && "Shuffle mask size mismatch");
+
+ for (unsigned i = 0; i != NumElts; ++i) {
+ if (KnownUndef[i])
+ Mask[i] = SM_SentinelUndef;
+ else if (KnownZero[i])
+ Mask[i] = SM_SentinelZero;
+ }
+}
+
// Forward declaration (for getFauxShuffleMask recursive check).
// TODO: Use DemandedElts variant.
static bool getTargetShuffleInputs(SDValue Op, SmallVectorImpl<SDValue> &Inputs,
@@ -7256,15 +7272,8 @@ static bool getTargetShuffleInputs(SDVal
return false;
if (getTargetShuffleAndZeroables(Op, Mask, Inputs, KnownUndef, KnownZero)) {
- for (int i = 0, e = Mask.size(); i != e; ++i) {
- int &M = Mask[i];
- if (M < 0 || !ResolveKnownElts)
- continue;
- if (KnownUndef[i])
- M = SM_SentinelUndef;
- else if (KnownZero[i])
- M = SM_SentinelZero;
- }
+ if (ResolveKnownElts)
+ resolveTargetShuffleAndZeroables(Mask, KnownUndef, KnownZero);
return true;
}
if (getFauxShuffleMask(Op, DemandedElts, Mask, Inputs, DAG, Depth,
More information about the llvm-commits
mailing list