On Fri, Sep 2, 2022 at 7:24 PM Segher Boessenkool
<seg...@kernel.crashing.org> wrote:
>
> On Fri, Sep 02, 2022 at 12:02:54PM -0500, Peter Bergner wrote:
> > On 9/2/22 11:31 AM, Segher Boessenkool wrote:
> > > (Did you also look at non-MMA VIEW_CONVERT_EXPR uses btw?)
> >
> > I did.  It seemed they were all related to pointers to vectors and I 
> > remember
> > you mentioning that as one of the reasons for using VIEW_CONVERT_EXPR over
> > NOP_EXPR, so I left them alone to be safe.
>
> Huh?  I have no idea what you mean here.
>
> Casting from one pointer type to another never needs it.  Casting from a
> scalar integer type to a pointer type not either AFAIKi.  But I am not a
> Gimple expert, all this might be wrong, it isn't documented anywbere :-(

NOP_EXPR is for conversions between types with the same kind
(and pointer-to-integer and integer-to-pointer
conversions when pointer and integer are of the same size).
When used on vectors it converts the vector elements.  When you want to
re-interpret V4SI as V4SF you need VIEW_CONVERT_EXPR (bit_cast),
likewise V4SI interpreted as V16QI needs that.

Think of VIEW_CONVERT as bit_cast and NOP_EXPR as conversion.
Of course for some conversions (like unsigned int to int) you can also
use a VIEW_CONVERT since it's semantically the same.  In those cases
we canonicalize to NOP_EXPR via folding.

Richard.

>
>
> Segher

Reply via email to