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 4B5DC3858C36 for ; Tue, 23 Jan 2024 19:37:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B5DC3858C36 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4B5DC3858C36 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706038626; cv=none; b=KkDMPJ1J9gIGYBVOxmIuX3OSsPet/rAbJ7RwkqgQ0pYUKMVJCd9XLVdnHa6Z/v1+B/1tcX5gxSrUZ7bl+sDNIDZkIzbhMlqCzZT6XjDiIm09ZDzdSWyLxCe5vhAGVBLRVmo/B4uV6rnxuA0w2jARGtp2f8Uj3M82AFpIM0uupUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706038626; c=relaxed/simple; bh=17FBaihke5yOvx2WPM1SuV4RAF9n5mi27NHqQrWUjAc=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=ckuoQ7itnG4neU4uIOY0DYoJpL+ZNw5d6b9tL6T0WJQ0VP6owOP7lE3BJ60HmPo1EdPyLHF0qfo1RA0Qsla84DigIKnZSRqq0gsatmslsSvbb/aMx9ZZPXY2v2799M6M69Uk5C5Zk2c7bsZTOGUcGhndN2hviiIyy0KDvO5ZfBc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1706038622; bh=17FBaihke5yOvx2WPM1SuV4RAF9n5mi27NHqQrWUjAc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=DBl/ZHChveyls60H3zVZKNxrAF/49KVUQxl06u36JvKrHXhAIRToSdCkyePknGVjO G8mteLTdysaScrc+2Qgsyho381uprIPzXSl1RBrZZZ5nFlrRDFaOBK7Pt5mu1BZamK hjtMzZAH51onddrwjS69KbTyZIxnPbfc9U6+4FbE= Received: from [127.0.0.1] (unknown [IPv6:2001:470:683e::1]) (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 952D366F40; Tue, 23 Jan 2024 14:37:01 -0500 (EST) Message-ID: <645b17748995b75fc2a9c4368f8ab5d89cc0ff10.camel@xry111.site> Subject: Re: [PATCH v2 2/2] LoongArch: When the code model is extreme, the symbol address is obtained through macro instructions regardless of the value of -mexplicit-relocs. From: Xi Ruoyao To: chenglulu , gcc-patches@gcc.gnu.org Cc: i@xen0n.name, xuchenghua@loongson.cn Date: Wed, 24 Jan 2024 03:36:59 +0800 In-Reply-To: <883986d4-e17b-6381-b3ec-75519859e7ea@loongson.cn> References: <20240105034021.30177-1-chenglulu@loongson.cn> <20240105034021.30177-3-chenglulu@loongson.cn> <0fe0f370-a593-d060-d260-0e190986f833@loongson.cn> <4cdfda6960e75ccc6ccea6263ac02e79c9dba572.camel@xry111.site> <74482b5cbfef5a9d07185cd63430b3907fb389d1.camel@xry111.site> <7808ffa81093a41202b1a5c3cf12b76482741b1e.camel@xry111.site> <16929185-d182-c1d9-ba81-c8ce9dbe7eaf@loongson.cn> <4f2eb5a0-0791-0df8-d957-9fda9b122c85@loongson.cn> <1d4d46647c3fff7d3fb6441d039048f52cf88886.camel@xry111.site> <6078d647-4176-8aec-3384-d87c34464266@loongson.cn> <883986d4-e17b-6381-b3ec-75519859e7ea@loongson.cn> Autocrypt: addr=xry111@xry111.site; prefer-encrypt=mutual; keydata=mDMEYnkdPhYJKwYBBAHaRw8BAQdAsY+HvJs3EVKpwIu2gN89cQT/pnrbQtlvd6Yfq7egugi0HlhpIFJ1b3lhbyA8eHJ5MTExQHhyeTExMS5zaXRlPoiTBBMWCgA7FiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQrKrSDhnnEOPHFgD8D9vUToTd1MF5bng9uPJq5y3DfpcxDp+LD3joA3U2TmwA/jZtN9xLH7CGDHeClKZK/ZYELotWfJsqRcthOIGjsdAPuDgEYnkdPhIKKwYBBAGXVQEFAQEHQG+HnNiPZseiBkzYBHwq/nN638o0NPwgYwH70wlKMZhRAwEIB4h4BBgWCgAgFiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwwACgkQrKrSDhnnEOPjXgD/euD64cxwqDIqckUaisT3VCst11RcnO5iRHm6meNIwj0BALLmWplyi7beKrOlqKfuZtCLbiAPywGfCNg8LOTt4iMD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 Mon, 2024-01-22 at 15:27 +0800, chenglulu wrote: > > > The failure of this test case was because the compiler believes that = two > > > (UNSPEC_PCREL_64_PART2 [(symbol)]) instances would always produce the > > > same result, but this isn't true because the result depends on PC.=C2= =A0 Thus > > > (pc) needed to be included in the RTX, like: > > >=20 > > > =C2=A0=C2=A0 [(set (match_operand:DI 0 "register_operand" "=3Dr") > > > =C2=A0=C2=A0=C2=A0=C2=A0 (unspec:DI [(match_operand:DI 2 "") (pc)]= =20 > > > UNSPEC_LA_PCREL_64_PART1)) > > > =C2=A0=C2=A0=C2=A0 (set (match_operand:DI 1 "register_operand" "=3Dr"= ) > > > =C2=A0=C2=A0=C2=A0=C2=A0 (unspec:DI [(match_dup 2) (pc)] UNSPEC_LA_PC= REL_64_PART2))] > > >=20 > > > With this the buggy REG_UNUSED notes were gone.=C2=A0 But it then pre= vented > > > the CSE when loading the address of __tls_get_addr (i.e. if we addres= s > > > 10 TLE_LD symbols in a function it would emit 10 instances of "la.glo= bal > > > __tls_get_addr") so I added an REG_EQUAL note for it.=C2=A0 For symbo= ls other > > > than __tls_get_addr such notes are added automatically by optimizatio= n > > > passes. > > >=20 > > > Updated patch attached. > > >=20 > > I'm eliminating redundant la.global directives in my macro=20 > > implementation. > >=20 > > I will be testing this patch. > >=20 > >=20 > >=20 > >=20 > With this patch, spec2006 can pass the test, but spec2017 621 and 654=20 > tests fail. > I haven't debugged the specific cause of the problem yet. Try removing the TARGET_DELEGITIMIZE_ADDRESS hook? After eating some unhealthy food in the midnight I realized the hook only papers over the same issue caused spec2006 failure. I tried a bootstrap with BOOT_CFLAGS=3D-O2 -g -mcmodel=3Dextreme and TARGET_DELEGITIMIZE_ADDRES= S commented out, and there is no more spurious "note: non-delegitimized UNSPEC UNSPEC_LA_PCREL_64_PART1 (42) found in variable location" things. I feel that this hook is still written in a buggy way, so maybe removing it will solve the spec2017 issue. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University