Fix bug with fail when --target=avx1.1-i32x8,avx2-i32x8 - avx11 is not a valid target anymore, need more complete string
This commit is contained in:
42
ispc.cpp
42
ispc.cpp
@@ -838,6 +838,9 @@ Target::GetTripleString() const {
|
|||||||
return triple.str();
|
return triple.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function returns string representation of ISA for the purpose of
|
||||||
|
// mangling. And may return any unique string, preferably short, like
|
||||||
|
// sse4, avx and etc.
|
||||||
const char *
|
const char *
|
||||||
Target::ISAToString(ISA isa) {
|
Target::ISAToString(ISA isa) {
|
||||||
switch (isa) {
|
switch (isa) {
|
||||||
@@ -873,6 +876,45 @@ Target::GetISAString() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This function returns string representation of default target corresponding
|
||||||
|
// to ISA. I.e. for SSE4 it's sse4-i32x4, for AVX11 it's avx1.1-i32x8. This
|
||||||
|
// string may be used to initialize Target.
|
||||||
|
const char *
|
||||||
|
Target::ISAToTargetString(ISA isa) {
|
||||||
|
switch (isa) {
|
||||||
|
#ifdef ISPC_ARM_ENABLED
|
||||||
|
case Target::NEON8:
|
||||||
|
return "neon-8";
|
||||||
|
case Target::NEON16:
|
||||||
|
return "neon-16";
|
||||||
|
case Target::NEON32:
|
||||||
|
return "neon-32";
|
||||||
|
#endif
|
||||||
|
case Target::SSE2:
|
||||||
|
return "sse2-i32x4";
|
||||||
|
case Target::SSE4:
|
||||||
|
return "sse4-i32x4";
|
||||||
|
case Target::AVX:
|
||||||
|
return "avx1-i32x8";
|
||||||
|
case Target::AVX11:
|
||||||
|
return "avx1.1-i32x8";
|
||||||
|
case Target::AVX2:
|
||||||
|
return "avx2-i32x8";
|
||||||
|
case Target::GENERIC:
|
||||||
|
return "generic-4";
|
||||||
|
default:
|
||||||
|
FATAL("Unhandled target in ISAToTargetString()");
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
Target::GetISATargetString() const {
|
||||||
|
return ISAToString(m_isa);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
lGenericTypeLayoutIndeterminate(llvm::Type *type) {
|
lGenericTypeLayoutIndeterminate(llvm::Type *type) {
|
||||||
if (type->isPrimitiveType() || type->isIntegerTy())
|
if (type->isPrimitiveType() || type->isIntegerTy())
|
||||||
|
|||||||
9
ispc.h
9
ispc.h
@@ -214,9 +214,16 @@ public:
|
|||||||
/** Convert ISA enum to string */
|
/** Convert ISA enum to string */
|
||||||
static const char *ISAToString(Target::ISA isa);
|
static const char *ISAToString(Target::ISA isa);
|
||||||
|
|
||||||
/** Returns a string like "avx" encoding the target. */
|
/** Returns a string like "avx" encoding the target. Good for mangling. */
|
||||||
const char *GetISAString() const;
|
const char *GetISAString() const;
|
||||||
|
|
||||||
|
/** Convert ISA enum to string */
|
||||||
|
static const char *ISAToTargetString(Target::ISA isa);
|
||||||
|
|
||||||
|
/** Returns a string like "avx1.1-i32x8" encoding the target.
|
||||||
|
This may be used for Target initialization. */
|
||||||
|
const char *GetISATargetString() const;
|
||||||
|
|
||||||
/** Returns the size of the given type */
|
/** Returns the size of the given type */
|
||||||
llvm::Value *SizeOf(llvm::Type *type,
|
llvm::Value *SizeOf(llvm::Type *type,
|
||||||
llvm::BasicBlock *insertAtEnd);
|
llvm::BasicBlock *insertAtEnd);
|
||||||
|
|||||||
@@ -2443,7 +2443,7 @@ Module::CompileAndOutput(const char *srcFile,
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
const char *firstISA;
|
const char *firstISA;
|
||||||
while (i < Target::NUM_ISAS && firstTargetMachine == NULL) {
|
while (i < Target::NUM_ISAS && firstTargetMachine == NULL) {
|
||||||
firstISA = Target::ISAToString((Target::ISA) i);
|
firstISA = Target::ISAToTargetString((Target::ISA) i);
|
||||||
firstTargetMachine = targetMachines[i++];
|
firstTargetMachine = targetMachines[i++];
|
||||||
}
|
}
|
||||||
Assert(firstTargetMachine != NULL);
|
Assert(firstTargetMachine != NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user