[PATCH] D40577: Clang support for simd functions
Matt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 28 13:37:02 PST 2017
mmasten created this revision.
This patch adds "vector-variants" function attributes to simd functions.
https://reviews.llvm.org/D40577
Files:
lib/CodeGen/CGOpenMPRuntime.cpp
Index: lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7565,10 +7565,18 @@
Masked.push_back('M');
break;
}
+
+ std::string Buffer;
+ if (Fn->hasFnAttribute("vector-variants")) {
+ llvm::Attribute Attr = Fn->getFnAttribute("vector-variants");
+ Buffer = Attr.getValueAsString().str();
+ }
+ llvm::raw_string_ostream Out(Buffer);
+
for (auto Mask : Masked) {
for (auto &Data : ISAData) {
- SmallString<256> Buffer;
- llvm::raw_svector_ostream Out(Buffer);
+ if (!Buffer.empty())
+ Out << ",";
Out << "_ZGV" << Data.ISA << Mask;
if (!VLENVal) {
Out << llvm::APSInt::getUnsigned(Data.VecRegSize /
@@ -7596,9 +7604,11 @@
Out << 'a' << ParamAttr.Alignment;
}
Out << '_' << Fn->getName();
- Fn->addFnAttr(Out.str());
+ Out.flush();
}
}
+
+ Fn->addFnAttr("vector-variants", Out.str());
}
void CGOpenMPRuntime::emitDeclareSimdFunction(const FunctionDecl *FD,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40577.124633.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171128/96c31b81/attachment.bin>
More information about the cfe-commits
mailing list