On Mon, Jan 21, 2019 at 10:14 AM Alexander Monakov <amona...@ispras.ru> wrote:
>
> On Mon, 21 Jan 2019, Richard Biener wrote:
>
> > I'm not sure whether it's permitted to use this in C++ or not (and whether
> > the C usage is now officially sanctioned other than via a non-normative
> > footnote) - but at least GCC will guarantee that it works.
>
> My impression is that, via the "active member" wording, C++ standard says
> clearly this is UB.  I assume on the GCC side the intention is to treat it
> like in C (for POD types only?..), but I don't want to go there in the
> "Vector Extensions" section.  Hence my patch limits the suggestion to C.
>
> I think in C++ it's a bit less of an issue anyway, because people can use
> operator overloading to achieve a similar end result, with some extra legwork.
>
> Do you want me to change the text somehow?

No, it was just a note from my side.

> > Might be interesting to show how to do argument marshalling with the
> > same union.
>
> Sorry, I don't see what you mean here; can you give an example or elaborate?

when you call a function with v4si signature but want to pass it a result
from a __mm intrinsic you'd need a temporary union to do the marshalling.
I think you can use a union argument in the function itself and you can
elide the temporary then if you use transparent_union.  But I didn't try.

Richard.

> Thanks!
> Alexander

Reply via email to