From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 5B3AF3858CDA for ; Mon, 5 Sep 2022 14:52:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5B3AF3858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 285Ep9oY016276; Mon, 5 Sep 2022 09:51:09 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 285Ep83f016273; Mon, 5 Sep 2022 09:51:08 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 5 Sep 2022 09:51:08 -0500 From: Segher Boessenkool To: Richard Biener Cc: Peter Bergner , GCC Patches Subject: Re: [PATCH] rs6000: Use NO_EXPR to cast to MMA pointer types Message-ID: <20220905145108.GB25951@gate.crashing.org> References: <58acc8c2-b6a4-e9ec-c89b-ad841cf759ed@linux.ibm.com> <20220902163134.GT25951@gate.crashing.org> <996b058b-a9de-6a0f-c4d0-45a30387f591@linux.ibm.com> <20220902172325.GV25951@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Sep 05, 2022 at 11:25:21AM +0200, Richard Biener wrote: > On Fri, Sep 2, 2022 at 7:24 PM Segher Boessenkool > 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. Thanks for the explanation! About that last point... You say VIEW_CONVERT_EXPR is folded to NOP_EXPR where possible. Does that happen in all cases / can we depend on that? So that in target code like what started this thread the only real difference is documentation of intent? (Which never is unimportant of course!) Segher