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 9B6E7395C065 for ; Wed, 16 Nov 2022 18:59:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B6E7395C065 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 2AGIwRcZ020794; Wed, 16 Nov 2022 12:58:28 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 2AGIwRQE020793; Wed, 16 Nov 2022 12:58:27 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 16 Nov 2022 12:58:27 -0600 From: Segher Boessenkool To: "Kewen.Lin" Cc: GCC Patches , David Edelsohn , Peter Bergner , Michael Meissner Subject: Re: [PATCH 2/2] rs6000: Refine integer comparison handlings in rs6000_emit_vector_compare Message-ID: <20221116185827.GX25951@gate.crashing.org> References: <247bf71b-e0ab-7cf7-098b-a106a0764301@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <247bf71b-e0ab-7cf7-098b-a106a0764301@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.0 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On Wed, Nov 16, 2022 at 02:51:04PM +0800, Kewen.Lin wrote: > The current handlings in rs6000_emit_vector_compare is a bit > complicated to me, especially after we emit vector float > comparison insn with the given code directly. This patch is > to refine the handlings for vector integer comparison operators, > it becomes not recursive, and we don't need the helper function > rs6000_emit_vector_compare_inner any more. That sounds nice. > /* In vector.md, we support all kinds of vector float point > comparison operators in a comparison rtl pattern, we can > just emit the comparison rtx insn directly here. Besides, > we should have a centralized place to handle the possibility > - of raising invalid exception. */ > - if (GET_MODE_CLASS (dmode) == MODE_VECTOR_FLOAT) > + of raising invalid exception. Also emit directly for vector > + integer comparison operators EQ/GT/GTU. */ > + if (GET_MODE_CLASS (dmode) == MODE_VECTOR_FLOAT > + || rcode == EQ > + || rcode == GT > + || rcode == GTU) The comment still says it handles FP only. That would be best to keep imo: add a separate block of code to handle the integer stuff you want to add. You get the same or better generated code, the compiler is smart enough. Code is for the user to read, and C is not a portable assembler language. This whole series needs to be factored better, it does way too many things, and only marginally related things, at every step. Or I don't see it anyway :-) Segher