forked from OSchip/llvm-project
AST: extend MS decoration handling for extended vectors
We correctly handled extended vectors of non-floating point types. However, we have the Intel style builtins which MSVC also supports which do overlap in sizes with the floating point extended vectors. This would result in overloading of floating point extended vector types which matched sizes (e.g. <3 x float> would be backed by a <4 x float> and thus match sizes) to be mangled similarly. Extended vectors are a clang extension which live outside of the builtins, so mangle them all similarly. This change just extends the current scheme to treat floating point types similar to the way that we treat other types currently. This now allows the swift runtime to be built for Windows again. llvm-svn: 345479
This commit is contained in:
parent
3497d536f7
commit
21568183ec
|
@ -2569,18 +2569,20 @@ void MicrosoftCXXNameMangler::mangleType(const VectorType *T, Qualifiers Quals,
|
|||
// Pattern match exactly the typedefs in our intrinsic headers. Anything that
|
||||
// doesn't match the Intel types uses a custom mangling below.
|
||||
size_t OutSizeBefore = Out.tell();
|
||||
llvm::Triple::ArchType AT =
|
||||
getASTContext().getTargetInfo().getTriple().getArch();
|
||||
if (AT == llvm::Triple::x86 || AT == llvm::Triple::x86_64) {
|
||||
if (Width == 64 && ET->getKind() == BuiltinType::LongLong) {
|
||||
mangleArtificalTagType(TTK_Union, "__m64");
|
||||
} else if (Width >= 128) {
|
||||
if (ET->getKind() == BuiltinType::Float)
|
||||
mangleArtificalTagType(TTK_Union, "__m" + llvm::utostr(Width));
|
||||
else if (ET->getKind() == BuiltinType::LongLong)
|
||||
mangleArtificalTagType(TTK_Union, "__m" + llvm::utostr(Width) + 'i');
|
||||
else if (ET->getKind() == BuiltinType::Double)
|
||||
mangleArtificalTagType(TTK_Struct, "__m" + llvm::utostr(Width) + 'd');
|
||||
if (!isa<ExtVectorType>(T)) {
|
||||
llvm::Triple::ArchType AT =
|
||||
getASTContext().getTargetInfo().getTriple().getArch();
|
||||
if (AT == llvm::Triple::x86 || AT == llvm::Triple::x86_64) {
|
||||
if (Width == 64 && ET->getKind() == BuiltinType::LongLong) {
|
||||
mangleArtificalTagType(TTK_Union, "__m64");
|
||||
} else if (Width >= 128) {
|
||||
if (ET->getKind() == BuiltinType::Float)
|
||||
mangleArtificalTagType(TTK_Union, "__m" + llvm::utostr(Width));
|
||||
else if (ET->getKind() == BuiltinType::LongLong)
|
||||
mangleArtificalTagType(TTK_Union, "__m" + llvm::utostr(Width) + 'i');
|
||||
else if (ET->getKind() == BuiltinType::Double)
|
||||
mangleArtificalTagType(TTK_Struct, "__m" + llvm::utostr(Width) + 'd');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,5 +94,9 @@ typedef __attribute__((ext_vector_type(4))) int vi4b;
|
|||
void foovi4b(vi4b) {}
|
||||
// CHECK: define dso_local void @"?foovi4b@@YAXT?$__vector@H$03@__clang@@@Z"
|
||||
|
||||
typedef float __attribute__((__ext_vector_type__(3))) vf3;
|
||||
void foovf3(vf3) {}
|
||||
// CHECK: define dso_local void @"?foovf3@@YAXT?$__vector@M$02@__clang@@@Z"
|
||||
|
||||
// Clang does not support vectors of complex types, so we can't test the
|
||||
// mangling of them.
|
||||
|
|
Loading…
Reference in New Issue