This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC, patch] New attribute to create target clones


Forget C++ tests.

On Fri, Jul 31, 2015 at 1:19 AM, Evgeny Stupachenko <evstupac@gmail.com> wrote:
> Hi All,
>
> The patch enables new attribute 'ctarget',
> The attribute force compiler to create clones of a function with the attribute.
>
> For example:
> __attribute__((ctarget("avx","arch=slm","arch=core-avx2","default")))
> int
> foo ()
>
> will create 3 clones of foo() optimized for corresponding targets and
> replace all foo() calls with ifunc resolver.
> The patch include new tests for the feature.
>
> Currently default ctarget means that foo() will be optimized with
> current compiler options and target.
> The other option is to switch target to target specific minimum (like
> target x86-64). Is it better?
>
> What do you think about attribute name? 'ctarget' is short but not
> informative. Other variants are 'target_clones', 'targets'...
>
> Below is ChangeLog. Attached patch passed make check on x86.
>
> Thanks,
> Evgeny
>
> 2015-07-31  Evgeny Stupachenko  <evstupac@gmail.com>
>
> gcc/
>         * Makefile.in (OBJS): Add multiple_target.o.
>         * multiple_target.c (make_attribute): New.
>         (create_dispatcher_calls): Ditto.
>         (expand_target_clones): Ditto.
>         (ipa_target_clone): Ditto.
>         * passes.def (pass_target_clone): New ipa pass.
>         * tree-pass.h (make_pass_target_clone): Ditto.
>
> gcc/c-family
>         * c-common.c (handle_ctarget_attribute): New.
>         * (c_common_attribute_table): Add handle_ctarget_attribute.
>         * (handle_always_inline_attribute): Add check on ctarget attribute.
>         * (handle_target_attribute): Ditto.
>
> gcc/testsuite
>         * gcc.dg/mvc1.c: New test for multiple targets cloning.
>         * gcc.dg/mvc2.c: Ditto.
>         * gcc.dg/mvc3.c: Ditto.
>         * gcc.dg/mvc4.c: Ditto.
>         * gcc.dg/mvc5.c: Ditto.
>         * gcc.dg/mvc6.c: Ditto.
>         * gcc.dg/mvc7.c: Ditto.
>         * g++.dg/ext/mvc1.C: Ditto.
>         * g++.dg/ext/mvc2.C: Ditto.
>         * g++.dg/ext/mvc3.C: Ditto.

Attachment: ctarget_attribute_C++tests.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]