Merge pull request #1043 from Vsevolod-Livinskij/multitarget

Prohibit short vectors in knl-generic multitarget
This commit is contained in:
Dmitry Babokin
2015-05-21 16:18:51 +03:00

View File

@@ -198,7 +198,6 @@ inline constant_iterator constant_end(const llvm::Function *F) {
}
///////////////////////////////////////////////////////////////////////////////
// FIXME:
namespace {
/// TypeFinder - Walk over a module, identifying all of the types that are
@@ -1811,10 +1810,21 @@ void CWriter::printConstant(llvm::Constant *CPV, bool Static) {
} else {
Out << '(';
if (CPV->getNumOperands()) {
// It is a kludge. It is needed because we cannot support short vectors
// when generating code for knl-generic in multitarget mode.
// Short vectors are mapped to "native" vectors and cause AVX-512 code
// generation in static block initialization (__vec16_* in ::init function).
bool isGenericKNL = g->target->getISA() == Target::GENERIC &&
!g->target->getTreatGenericAsSmth().empty() &&
g->mangleFunctionsWithTarget;
if (isGenericKNL && CPV->getOperand(0)->getType()->isVectorTy())
llvm::report_fatal_error("knl-generic-* target doesn's support short vectors");
Out << ' ';
printConstant(llvm::cast<llvm::Constant>(CPV->getOperand(0)), Static);
for (unsigned i = 1, e = CPV->getNumOperands(); i != e; ++i) {
Out << ", ";
if (isGenericKNL && CPV->getOperand(i)->getType()->isVectorTy())
llvm::report_fatal_error("knl-generic-* target doesn's support short vectors");
printConstant(llvm::cast<llvm::Constant>(CPV->getOperand(i)), Static);
}
}