This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PowerPC] avoid horrible union access
Andrew Pinski <pinskia@physics.uc.edu> writes:
> On Feb 4, 2006, at 6:22 PM, Alan Modra wrote:
> >
> > Yes, see node "Extended Asm". pack() even works when called from a
> > function which is itself inlined, although of course it's not ideal to
> > have the function return forced into fr1/fr2 in that case.
>
> I wonder if there is a way to say a subregister in inline-asm (this
> would be better than what you are doing):
> Something like:
> __asm__ ("" : "=f" (ld) : "0l" (hi), "0h" (lo));
>
> And that would cause the code gen to be right.
> Though there is no way and the reason why the union trick
> does not work is because we don't turn
>
> union {long double a; double b[2];}
> a.c = in;
> hi = a.b[1];
>
> into:
>
> hi = VIEW_CONVERT_EXPR(double[2])<in>[1];
>
> which would really fix the whole issue.
That sounds like a much better plan; could we do that instead? I'd
much rather have the compiler output the right code from reasonable C
input than have to hack about with asm statements.