From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 373043858D1E for ; Tue, 4 Apr 2023 08:41:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 373043858D1E Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1680597663; bh=tcQoq5yhwtp6hjOkMtjFzdr+b+EelL47q5T+2wq5kAg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=TWohc4QHipEXh9Q+/KMhnxiMTPjJdOwJD0mrZnOVY1rxWz4rffPuZVATwKTdHtksh BA8ZBhcNlvvWhBXERrxti5uGP39oanNf+c5clcycqYNW2QMpSIaKgLbDzofkwjPeCO JSaum+kA2cIfel3R+4Sn4tAJxc29DYsxvf/Vjlis= Received: from [192.168.124.11] (unknown [113.140.29.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 2401F65A50; Tue, 4 Apr 2023 04:41:01 -0400 (EDT) Message-ID: Subject: Re: [GCC14 PATCH] LoongArch: Optimize additions with immediates From: Xi Ruoyao To: Lulu Cheng , gcc-patches@gcc.gnu.org Cc: WANG Xuerui , Chenghua Xu Date: Tue, 04 Apr 2023 16:40:59 +0800 In-Reply-To: <62922ce154f7f52147341b905d3c844cd50e6682.camel@xry111.site> References: <20230402140044.23073-1-xry111@xry111.site> <39b42972-9a0f-3ada-b9b9-2c53da946217@loongson.cn> <62922ce154f7f52147341b905d3c844cd50e6682.camel@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,LIKELY_SPAM_FROM,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: On Tue, 2023-04-04 at 16:00 +0800, Xi Ruoyao via Gcc-patches wrote: > On Tue, 2023-04-04 at 11:01 +0800, Lulu Cheng wrote: >=20 > /* snip */ >=20 > > > +unsigned long f10 (unsigned long x) { return x - 0x80000000l * 2; } > > > +unsigned long f11 (unsigned long x) { return x - 0x80000000l * 2; } > > =C2=A0These two test cases are duplicates. >=20 > /* snip */ >=20 > >=20 > > > +unsigned int g10 (unsigned int x) { return x - 0x80000000l * 2; } > > > +unsigned int g11 (unsigned int x) { return x - 0x80000000l * 2; } > > Ditto. >=20 > I'll fix them in V2. >=20 > > I found that adding this log test case gcc.target/loongarch/stack-check= -cfa-1.c and gcc.target/loongarch/stack-check-cfa-2.c test failed. > > Although the test fails, the generated assembly code is better, and the= re is no problem with the logic of the assembly code. I haven't checked the= reason for this yet. >=20 > Looks like the change hides PR109035 (like -fpie) for some reason. (But > I still don't understand the root cause of PR109035 anyway.) V2 sent with test cases fixed. /* snip */ > Technically there should be "addu16i.d $r3,$r3,-1" in the prologue and > "addu16i.d $r3,$r3,2" in the epilogue, so we can avoid using r14/r13. > I'll try modifying loongarch_expand_{pro,epi}logue for this. Will do this later because I'm too stupid to understand loongarch_first_stack_step function quickly :). --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University