summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/attr-target-mv.c
Commit message (Collapse)AuthorAgeFilesLines
* [CodeGen] Add alias for cpu_dispatch function with IFunc & Fix resolver ↵Fangrui Song2019-09-111-18/+18
| | | | | | | | | | | | | | linkage type Multi-versioned functions defined by cpu_dispatch and implemented with IFunc can not be called outside the translation units where they are defined due to lack of symbols. This patch add function aliases for these functions and thus make them visible outside. Differential Revision: https://reviews.llvm.org/D67058 Patch by Senran Zhang llvm-svn: 371586
* IR: print value numbers for unnamed function argumentsTim Northover2019-08-031-1/+1
| | | | | | | | | | For consistency with normal instructions and clarity when reading IR, it's best to print the %0, %1, ... names of function arguments in definitions. Also modifies the parser to accept IR in that form for obvious reasons. llvm-svn: 367755
* Make CPUDispatch resolver emit dependent functions.Erich Keane2018-12-071-0/+2
| | | | | | | | | | Inline cpu_specific versions referenced before the cpu_dispatch function weren't properly emitted, since they hadn't been referred to. This patch ensures that during resolver generation that all appropriate versions are emitted. Change-Id: I94c3766aaf9c75ca07a0ad8258efdbb834654ff8 llvm-svn: 348600
* Fix spelling of WINDOWS in a testErich Keane2018-12-071-1/+1
| | | | | Change-Id: I232515655359f14308e1c5509c4b7db96d1fafcb llvm-svn: 348598
* Revert "Multiversioning- Ensure all MV functions are emitted."Erich Keane2018-12-071-26/+23
| | | | | | | | | This reverts commit 65df29f9318ac13a633c0ce13b2b0bccf06e79ca. AS suggested by @rsmith here: https://reviews.llvm.org/rL345839 I'm reverting this and solving the initial problem in a different way. llvm-svn: 348595
* Correct 'target' default behavior on redecl, allow forward declaration.Erich Keane2018-11-281-1/+52
| | | | | | | | | | | | | | | | | | | | | | | Declarations without the attribute were disallowed because it would be ambiguous which 'target' it was supposed to be on. For example: void ___attribute__((target("v1"))) foo(); void foo(); // Redecl of above, or fwd decl of below? void ___attribute__((target("v2"))) foo(); However, a first declaration doesn't have that problem, and erroring prevents it from working in cases where the forward declaration is useful. Additionally, a forward declaration of target==default wouldn't properly cause multiversioning, so this patch fixes that. The patch was not split since the 'default' fix would require implementing the same check for that case, followed by undoing the same change for the fwd-decl implementation. Change-Id: I66f2c5bc2477bcd3f7544b9c16c83ece257077b0 llvm-svn: 347805
* Multiversioning- Ensure all MV functions are emitted.Erich Keane2018-11-011-23/+26
| | | | | | | | Multiverson function versions are always used (by the resolver), so ensure that they are always emitted. Change-Id: I5d2e0841fddf0d18918b3fb92ae76814add7ee96 llvm-svn: 345839
* Implement Function Multiversioning for Non-ELF Systems.Erich Keane2018-10-251-77/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | Similar to how ICC handles CPU-Dispatch on Windows, this patch uses the resolver function directly to forward the call to the proper function. This is not nearly as efficient as IFuncs of course, but is still quite useful for large functions specifically developed for certain processors. This is unfortunately still limited to x86, since it depends on __builtin_cpu_supports and __builtin_cpu_is, which are x86 builtins. The naming for the resolver/forwarding function for cpu-dispatch was taken from ICC's implementation, which uses the unmodified name for this (no mangling additions). This is possible, since cpu-dispatch uses '.A' for the 'default' version. In 'target' multiversioning, this function keeps the '.resolver' extension in order to keep the default function keeping the default mangling. Change-Id: I4731555a39be26c7ad59a2d8fda6fa1a50f73284 Differential Revision: https://reviews.llvm.org/D53586 llvm-svn: 345298
* Give Multiversion-inline functions linkonce linkageErich Keane2018-10-221-8/+8
| | | | | | | | | | | | Since multiversion variant functions can be inline, in C they become available-externally linkage. This ends up causing the variants to not be emitted, and not available to the linker. The solution is to make sure that multiversion functions are always emitted by marking them linkonce. Change-Id: I897aa37c7cbba0c1eb2c57ee881d5000a2113b75 llvm-svn: 344957
* [X86] When checking the bits in cpu_features for function multiversioning ↵Craig Topper2018-10-201-1/+16
| | | | | | | | | | | | | | | | | | | dispatcher in the resolver, make sure all the required bits are set. Not just one of them Summary: The multiversioning code repurposed the code from __builtin_cpu_supports for checking if a single feature is enabled. That code essentially performed (_cpu_features & (1 << C)) != 0. But with the multiversioning path, the mask is no longer guaranteed to be a power of 2. So we return true anytime any one of the bits in the mask is set not just all of the bits. The correct check is (_cpu_features & mask) == mask Reviewers: erichkeane, echristo Reviewed By: echristo Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53460 llvm-svn: 344824
* [CodeGen] Fix a crash on mangling multiversioned functionsGeorge Burgess IV2018-01-171-0/+12
| | | | | | | `multiVersionSortPriority` expects features to have no prefix. We currently carry them around in the format "+${feature}". llvm-svn: 322618
* Move target MV resolver to COMDATErich Keane2018-01-161-3/+3
| | | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=35921 The resolver functions should be in their own COMDAT regions. This patch sets that up. Differential Revision: https://reviews.llvm.org/D42110 llvm-svn: 322592
* Implement Attribute Target MultiVersioningErich Keane2018-01-081-0/+79
GCC's attribute 'target', in addition to being an optimization hint, also allows function multiversioning. We currently have the former implemented, this is the latter's implementation. This works by enabling functions with the same name/signature to coexist, so that they can all be emitted. Multiversion state is stored in the FunctionDecl itself, and SemaDecl manages the definitions. Note that it ends up having to permit redefinition of functions so that they can all be emitted. Additionally, all versions of the function must be emitted, so this also manages that. Note that this includes some additional rules that GCC does not, since defining something as a MultiVersion function after a usage has been made illegal. The only 'history rewriting' that happens is if a function is emitted before it has been converted to a multiversion'ed function, at which point its name needs to be changed. Function templates and virtual functions are NOT yet supported (not supported in GCC either). Additionally, constructors/destructors are disallowed, but the former is planned. llvm-svn: 322028
OpenPOWER on IntegriCloud