This is the mail archive of the gcc@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: How to implement efficiently builtins for dual-result instructions ?


Paolo Bonzini <bonzini@gnu.org> writes:

> > To invoke this instruction from the source level, a compiler builtin
> > is provided.
> > Since C syntax doesn't provide functions with two results, this builtin refers
> > to them via pointers:__super_ld32( int* x, int *y, int *a)
> 
> I did something similar in a private port by folding the builtin to
> 
>    long long tmp = __super_ld32_dimode (a);
>    *x = (int) tmp;
>    *y = (int) (tmp >> 32);
> 
> Then you create the builtin as returning a DImode, but the
> lower-subreg pass will be able to split the DImode pseudo into
> non-consecutive hard registers.

Yes, I have followed a similar approach in the past.  It generates the
most efficient code of various different approaches I have tried.  At
least at the time, with gcc 4.0.

I actually had the functions return structs, and I provided other
builtin functions to access the fields of the struct.  Those functions
were folded in TARGET_FOLD_BUILTIN to COMPONENT_REFs.

Ian


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