[PATCH][x86] Teach how to fold target specific dags for packed shifts by immedate count into build_vector.
Nadav Rotem
nrotem at apple.com
Wed Dec 25 22:57:53 PST 2013
Overall the patch LGTM. Do we have something like that for the non-target-specific code? If not then we should move it there and figure out a way to handle the target-specific x86 nodes.
+// Return true if this is a BUILD_VECTOR of ConstantSDNodes.
+// This is a helper function used by `getTargetVShiftByConstNode`.
+static bool isBuildVectorOfConstantSDNodes(SDValue N) {
+ if (N->getOpcode() != ISD::BUILD_VECTOR)
+ return false;
+
+ for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
+ if (!isa<ConstantSDNode>(N->getOperand(i)))
+ return false;
+ return true;
+}
+
You can also handle UNDEFs here.
More information about the llvm-commits
mailing list