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 720E33857009 for ; Thu, 16 Sep 2021 23:40:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 720E33857009 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 18GNd2qS013441; Thu, 16 Sep 2021 18:39:02 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 18GNcuXi013434; Thu, 16 Sep 2021 18:38:56 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 16 Sep 2021 18:38:56 -0500 From: Segher Boessenkool To: Bill Schmidt Cc: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com Subject: Re: [PATCH 04/18] rs6000: Handle some recent MMA builtin changes Message-ID: <20210916233856.GP1583@gate.crashing.org> References: <06bf6e3615041d8bf6192eb1a681227e1bbc82d9.1630511334.git.wschmidt@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06bf6e3615041d8bf6192eb1a681227e1bbc82d9.1630511334.git.wschmidt@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 16 Sep 2021 23:40:09 -0000 Hi! On Wed, Sep 01, 2021 at 11:13:40AM -0500, Bill Schmidt wrote: > Peter Bergner recently added two new builtins __builtin_vsx_lxvp and > __builtin_vsx_stxvp. These happened to break a pattern in MMA builtins that > I had been using to automate gimple folding of MMA builtins. Previously, > every MMA function that could be folded had an associated internal function > that it was folded into. The LXVP/STXVP builtins are just folded directly > into memory operations. > > Instead of relying on this pattern, this patch adds a new attribute to > builtins called "mmaint," which is set for all MMA builtins that have an > associated internal builtin. The naming convention that adds _INTERNAL to > the builtin index name remains. > > The rest of the patch is just duplicating Peter's patch, using the new > builtin infrastructure. > * config/rs6000/rs6000-call.c > (rs6000_gimple_fold_new_mma_builtin): Handle RS6000_BIF_LXVP and > RS6000_BIF_STXVP. It is fine to end a changelog line in a colon. > + else if (fncode == RS6000_BIF_LXVP) > + { > + push_gimplify_context (true); > + tree offset = gimple_call_arg (stmt, 0); > + tree ptr = gimple_call_arg (stmt, 1); > + tree lhs = gimple_call_lhs (stmt); > + if (TREE_TYPE (TREE_TYPE (ptr)) != vector_pair_type_node) > + ptr = build1 (VIEW_CONVERT_EXPR, > + build_pointer_type (vector_pair_type_node), ptr); > + tree mem = build_simple_mem_ref (build2 (POINTER_PLUS_EXPR, > + TREE_TYPE (ptr), ptr, offset)); > + gimplify_assign (lhs, mem, &new_seq); > + pop_gimplify_context (NULL); > + gsi_replace_with_seq (gsi, new_seq, true); > + return true; > + } Fwiw, all those cases return, so those "else" are not needed. Also it would be nice if this could be factored a bit better, hrm. Is that "if" in there useful? Maybe add a helper function for it, then? Anyway: okay for trunk. Thanks! Segher