unsigned NumZero = 0;
unsigned NumNonZero = 0;
unsigned NonZeros = 0;
+ unsigned NumNonZeroImms = 0;
std::set<SDOperand> Values;
for (unsigned i = 0; i < NumElems; ++i) {
SDOperand Elt = Op.getOperand(i);
else {
NonZeros |= (1 << i);
NumNonZero++;
+ if (Elt.getOpcode() == ISD::Constant ||
+ Elt.getOpcode() == ISD::ConstantFP)
+ NumNonZeroImms++;
}
}
}
}
}
+ // A vector full of immediates; various special cases are already
+ // handled, so this is best done with a single constant-pool load.
+ if (NumNonZero == NumNonZeroImms)
+ return SDOperand();
+
// Let legalizer expand 2-wide build_vectors.
if (EVTBits == 64)
return SDOperand();
--- /dev/null
+; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse | grep movaps
+
+define <4 x float> @foo() {
+ ret <4 x float> <float 3.223542354, float 2.3, float 1.2, float 0.1>
+}