From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 5BC983858430 for ; Wed, 8 Dec 2021 15:46:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5BC983858430 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 228EA21763; Wed, 8 Dec 2021 15:46:39 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 05E6013B72; Wed, 8 Dec 2021 15:46:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id t1oPOl7TsGFCWwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:46:38 +0000 Subject: Re: [PATCH] nvptx: Use cvt to perform sign-extension of truncation. To: Roger Sayle , 'GCC Patches' References: <000101d79b2b$5304ee10$f90eca30$@nextmovesoftware.com> From: Tom de Vries Message-ID: <89ac20e7-237a-5059-a516-49961a27782a@suse.de> Date: Wed, 8 Dec 2021 16:46:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <000101d79b2b$5304ee10$f90eca30$@nextmovesoftware.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Wed, 08 Dec 2021 15:46:42 -0000 On 8/27/21 12:07 PM, Roger Sayle wrote: > > This patch introduces some new define_insn rules to the nvptx backend, > to perform sign-extension of a truncation (from and to the same mode), > using a single cvt instruction. As an example, the following function > > int foo(int x) { return (char)x; } > > with -O2 currently generates: > > mov.u32 %r24, %ar0; > mov.u32 %r26, %r24; > cvt.s32.s8 %value, %r26; > > and with this patch, now generates: > > mov.u32 %r24, %ar0; > cvt.s32.s8 %value, %r24; > > This patch has been tested on nvptx-none hosted by x86_64-pc-linux-gnu > with a top-level "make" (including newlib) and a "make check" with no > new regressions. Ok for mainline? > Hi Roger, thanks for the patch and apologies for the delay. I was not happy with negative-testing-only in the test-case, so I've split it up into 6 separate tests. The first one is not influenced by the patch, so I've committed that one separately. The other 5 I've committed together with the patch. Thanks, - Tom > > 2021-08-27 Roger Sayle > > gcc/ChangeLog > * config/nvptx/nvptx.md (*extend_trunc_2_qi, > *extend_trunc_2_hi, *extend_trunc_di2_si): New insns. > Use cvt to perform sign-extension of truncation in one step. > > gcc/testsuite/ChangeLog > * gcc.target/nvptx/exttrunc.c: New test case. > > > Roger > -- >