On Tue, Nov 1, 2016 at 1:09 AM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Mon, Oct 31, 2016 at 05:28:42PM -0500, Bill Schmidt wrote:
>> The PowerPC back end loses performance on vector intrinsics, because 
>> currently
>> all of them are treated as calls throughout the middle-end phases and only
>> expanded when they reach RTL.  Our version of altivec.h currently defines the
>> public names of overloaded functions (like vec_add) to be #defines for hidden
>> functions (like __builtin_vec_add), which are recognized in the parser as
>> requiring special back-end support.  Tables in rs6000-c.c handle dispatch of
>> the overloaded functions to specific function calls appropriate to the 
>> argument
>> types.
>
> This doesn't look very nice.  If all you care is that the builtins like
> __builtin_altivec_vaddubm etc. that __builtin_vec_add overloads into fold
> into generic vector operations under certain conditions, just fold those
> into whatever you want in targetm.gimple_fold_builtin (gsi).

Note that traditionally "overloading" with GCC "builtins" is done by
using varargs
and the "type generic" attribute.  That doesn't scale to return type overloading
though for which we usually added direct support to the parser (for example
for __builtin_shuffle).

The folding trick of course should work just fine.

Richard.

>         Jakub

Reply via email to