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 30B1E385DC33; Mon, 14 Sep 2020 21:00:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 30B1E385DC33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@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 08EKxaQx014498; Mon, 14 Sep 2020 15:59:36 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 08EKxank014497; Mon, 14 Sep 2020 15:59:36 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 14 Sep 2020 15:59:35 -0500 From: Segher Boessenkool To: Richard Biener Cc: luoxhu , GCC Patches , David Edelsohn , Bill Schmidt , linkw@gcc.gnu.org Subject: Re: [PATCH v2] rs6000: Expand vec_insert in expander instead of gimple [PR79251] Message-ID: <20200914205935.GB28786@gate.crashing.org> References: <98b124ee-b32d-71f7-a662-e0ce2520de6a@linux.ibm.com> <20200909134739.GX28786@gate.crashing.org> <20200909160057.GZ28786@gate.crashing.org> <572b36a7-2d52-2f46-05bd-140e16794a61@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2020 21:00:38 -0000 On Mon, Sep 14, 2020 at 11:47:56AM +0200, Richard Biener wrote: > this should be > > u[n % 4] = i; > > I guess. Is the % 4 mandated by the vec_insert semantics btw? Yes: VEC_INSERT (ARG1, ARG2, ARG3) Purpose: Returns a copy of vector ARG2 with element ARG3 replaced by the value of ARG1. Result value: A copy of vector ARG2 with element ARG3 replaced by the value of ARG1. This function uses modular arithmetic on ARG3 to determine the element number. For example, if ARG3 is out of range, the compiler uses ARG3 modulo the number of elements in the vector to determine the element position. The builtin requires it. The machine insns work like that, too, e.g.: vinswlx VRT,RA,RB if MSR.VEC=0 then Vector_Unavailable() index ← GPR[RA].bit[60:63] VSR[VRT+32].byte[index:index+3] ← GPR[RB].bit[32:63] Let index be the contents of bits 60:63 of GPR[RA]. The contents of bits 32:63 of GPR[RB] are placed into byte elements index:index+3 of VSR[VRT+32]. All other byte elements of VSR[VRT+32] are not modified. If index is greater than 12, the result is undefined. Segher