I've fixed ICE and review issues.
x86 make check and bootstrap passed.

Thanks,
Evgeny

ChangeLog

2015-09-25  Evgeny Stupachenko  <evstu...@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_target_clones_attribute): New.
        * (c_common_attribute_table): Add handle_target_clones_attribute.
        * (handle_always_inline_attribute): Add check on target_clones
        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.

gcc/doc
        * doc/extend.texi (target_clones): New attribute description.


On Wed, Sep 23, 2015 at 1:49 AM, Evgeny Stupachenko <evstu...@gmail.com> wrote:
> Thank you for the review.
> The patch still works with gcc 5, but the fail reproduced on trunk
> (looks like it appeared while patch was at review). I'll debug it and
> fix.
> As a workaround to test the feature...
> Removing
> "gimple_call_set_fndecl (call, idecl);" from multiple_target.c
> should resolve the ICE
>
> I'll fix the patch for trunk and send an update.
>
> Thanks,
> Evgeny
>
>
> On Wed, Sep 23, 2015 at 12:09 AM, Bernd Schmidt <bschm...@redhat.com> wrote:
>> On 09/22/2015 09:41 PM, Jeff Law wrote:
>>>
>>> Essentially it allows us to more easily support
>>> per-microarchitecture-optimized versions of functions.   You list just
>>> have to list the microarchitectures and the compiler handles the rest.
>>> Very simple, very easy.  I'd think it'd be particularly helpful for
>>> vectorization.
>>>
>>> You could emulate this with compiling the same source multiple times
>>> with different flags/defines and wire up on ifunc by hand.  But Evgeny's
>>> approach is vastly simpler.
>>
>>
>> As far as I can tell the ifunc is generated automatically (and the
>> functionality is documented as such), so the new target_clone doesn't buy
>> much. But one thing I didn't was that the existing support is only available
>> in C++, while Evgeny's patch works for C. That is probably an argument that
>> could be made for its inclusion.
>>
>> Or at least, it's supposed to work. As I said, I get verify_ssa failures on
>> the included testcases, and for a simpler one I just tried I get the clones
>> of the function, but not the resolver that ought to be generated.
>>
>>
>> Bernd

Attachment: target_clones.patch
Description: Binary data

Reply via email to