mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Lower ConstantAggregateZero into zeros
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24890 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -306,16 +306,29 @@ public:
|
|||||||
// Constant or ConstantFP node onto the ops list for each element of
|
// Constant or ConstantFP node onto the ops list for each element of
|
||||||
// the packed constant.
|
// the packed constant.
|
||||||
std::vector<SDOperand> Ops;
|
std::vector<SDOperand> Ops;
|
||||||
for (unsigned i = 0; i < NumElements; ++i) {
|
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) {
|
||||||
const Constant *CEl = C->getOperand(i);
|
if (MVT::isFloatingPoint(PVT)) {
|
||||||
|
for (unsigned i = 0; i != NumElements; ++i) {
|
||||||
|
const ConstantFP *El = cast<ConstantFP>(CP->getOperand(i));
|
||||||
|
Ops.push_back(DAG.getConstantFP(El->getValue(), PVT));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (unsigned i = 0; i != NumElements; ++i) {
|
||||||
|
const ConstantIntegral *El =
|
||||||
|
cast<ConstantIntegral>(CP->getOperand(i));
|
||||||
|
Ops.push_back(DAG.getConstant(El->getRawValue(), PVT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
assert(isa<ConstantAggregateZero>(C) && "Unknown packed constant!");
|
||||||
|
SDOperand Op;
|
||||||
if (MVT::isFloatingPoint(PVT))
|
if (MVT::isFloatingPoint(PVT))
|
||||||
Ops.push_back(DAG.getConstantFP(cast<ConstantFP>(CEl)->getValue(),
|
Op = DAG.getConstantFP(0, PVT);
|
||||||
PVT));
|
|
||||||
else
|
else
|
||||||
Ops.push_back(
|
Op = DAG.getConstant(0, PVT);
|
||||||
DAG.getConstant(cast<ConstantIntegral>(CEl)->getRawValue(),
|
Ops.assign(NumElements, Op);
|
||||||
PVT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the case where we have a 1-element vector, in which
|
// Handle the case where we have a 1-element vector, in which
|
||||||
// case we want to immediately turn it into a scalar constant.
|
// case we want to immediately turn it into a scalar constant.
|
||||||
if (Ops.size() == 1) {
|
if (Ops.size() == 1) {
|
||||||
|
Reference in New Issue
Block a user