From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 5DAF3385828D for ; Tue, 27 Jun 2023 07:46:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DAF3385828D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E32E2F4; Tue, 27 Jun 2023 00:47:27 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EFF0A3F663; Tue, 27 Jun 2023 00:46:42 -0700 (PDT) From: Richard Sandiford To: Oluwatamilore Adebayo Mail-Followup-To: Oluwatamilore Adebayo ,, , richard.sandiford@arm.com Cc: , Subject: Re: [PATCH 1/2] Mid engine setup [SU]ABDL References: <20230626153423.42763-1-oluwatamilore.adebayo@arm.com> Date: Tue, 27 Jun 2023 08:46:41 +0100 In-Reply-To: (Richard Sandiford's message of "Mon, 26 Jun 2023 21:50:08 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-21.3 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,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: Richard Sandiford writes: >> - VTYPE x, y, out; >> + VTYPE x, y; >> + WTYPE out; >> type diff; >> loop i in range: >> S1 diff = x[i] - y[i] >> S2 out[i] = ABS_EXPR ; >> >> - where 'type' is a integer and 'VTYPE' is a vector of integers >> - the same size as 'type' >> + where 'VTYPE' and 'WTYPE' are vectors of integers. >> + 'WTYPE' may be wider than 'VTYPE'. >> + 'type' is as wide as 'WTYPE'. > > I don't think the existing comment is right about the types. What we're > matching is scalar code, so VTYPE and (now) WTYPE are integers rather > than vectors of integers. Gah, sorry, I realise now that the point was that VTYPE and WTYPE are sequences rather than scalars. But patterns are used for SLP as well as loops, and the inputs and outputs might not be memory objects. So: > I think it would be clearer to write: > > S1 diff = (type) x[i] - (type) y[i] > S2 out[i] = ABS_EXPR <(WTYPE) diff>; > > since the promotions happen on the operands. > > It'd be good to keep the part about 'type' being an integer. > > Rather than: > > 'WTYPE' may be wider than 'VTYPE'. > 'type' is as wide as 'WTYPE'. > > maybe: > > 'type' is no narrower than 'VTYPE' (but may be wider) > 'WTYPE' is no narrower than 'type' (but may be wider) ...how about: TYPE1 x; TYPE2 y; TYPE3 x_cast = (TYPE3) x; // widening or no-op TYPE3 y_cast = (TYPE3) y; // widening or no-op TYPE3 diff = x_cast - y_cast; TYPE4 diff_cast = (TYPE4) diff; // widening or no-op TYPE5 abs = ABS(U)_EXPR ; (based on the comment above vect_recog_widen_op_pattern). Thanks, Richard