From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id 4E89738582AE for ; Tue, 6 Sep 2022 11:39:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E89738582AE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ispras.ru Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id A306340D403E; Tue, 6 Sep 2022 11:39:32 +0000 (UTC) Date: Tue, 6 Sep 2022 14:39:32 +0300 (MSK) From: Alexander Monakov To: Philipp Tomsich cc: gcc-patches@gcc.gnu.org, Vineet Gupta , Kito Cheng , Jojo R Subject: Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED In-Reply-To: <20220905214437.1275139-1-philipp.tomsich@vrull.eu> Message-ID: References: <20220905214437.1275139-1-philipp.tomsich@vrull.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 5 Sep 2022, Philipp Tomsich wrote: > +riscv_mode_rep_extended (scalar_int_mode mode, scalar_int_mode mode_rep) > +{ > + /* On 64-bit targets, SImode register values are sign-extended to DImode. */ > + if (TARGET_64BIT && mode == SImode && mode_rep == DImode) > + return SIGN_EXTEND; I think this leads to a counter-intuitive requirement that a hand-written inline asm must sign-extend its output operands that are bound to either signed or unsigned 32-bit lvalues. Will compiler users be aware of that? Moreover, without adjusting TARGET_TRULY_NOOP_TRUNCATION this should cause miscompilation when a 64-bit variable is truncated to 32 bits: the pre-existing hook says that nothing needs to be done to truncate, but the new hook says that the result of the truncation is properly sign-extended. The documentation for TARGET_MODE_REP_EXTENDED warns about that: In order to enforce the representation of mode, TARGET_TRULY_NOOP_TRUNCATION should return false when truncating to mode. Alexander