From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonicconh6002-vm1.mail.ssk.yahoo.co.jp (sonicconh6002-vm1.mail.ssk.yahoo.co.jp [182.22.37.26]) by sourceware.org (Postfix) with ESMTPS id 442223858D35 for ; Fri, 6 Jan 2023 06:57:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 442223858D35 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=yahoo.co.jp Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.co.jp X-YMail-OSG: O71ISCkVM1lis0XdrRrbhh49HvP_Wg9iE1n684fSzL7VgFT3mnVMtYh4M30_oKl 4vBSRj31Jch2v_I7lRErSnTH_yxoSPyNZntJ0Ok1yIO1ZrB.YKT9UhKzeT0Ctg1rn94mvDIBB4X1 rdZv.aSZYaCoFSjiRptQsMDmsLgrdU2aXS.q6FQSmQrsCG_XSzC3pHxC8zYqaFXhD_P9kn70yvQK VmoiDZFG.T2OaR4O_.FapW70IEdwG.nQicD6FMsHJjUggyYCgWS.JhtqDVc_kb96IbbuELZuR2NC iY.T33ZjAklc9OfXPJrJjcDF7aD_VoQm0WKhddPuQqkV21Fy3odGG1G5yuvfbhuXVJWpgAAAfMFX ERxyoBKrGdOa9F.XdSqSM.0RuyxeWK7GnOwTBkpRsqrUJkXBlWfn2TTSj6j4siU3HpWb4eHi9SZE jqOxYFNDglWdrPnry5HLE.Q348B_TOJ_R2gnQGDjO3g_lUaXUXnnmanfTVVMSLjbg_OnKVXb2dud jsWBnFc1_k_e1f.EhN28C.2wnA1p3jLNj4WaJLzlJwjDSRI.6MqcyxG01xQVRYpIuR8Er_OLyfi9 F3EKDOAdu75E3cad8OTK8HrsdViesuQQEKC28NWOPJenF_1YbghEsyQnfqqa0ZZpZpn0HP9HtqBw eaac3PrKSxT2JkjSuQgtvrMOpl1UkyUGN4ZuYoMHnDolp34MgBprcxdj.h1N2Cq0gzM3BtsJ6h1t xe.JEnt7nOSM15u9l.xDoDF9qFbWO930H9F.6t8JjeXXOfB1sv.julmjFAalig_B77p7hSIjRrpr ENengkUW0oWB44cgzPRuZySzX7fJzhIfn2ktXsmVBdg1PqcZTkE9P_8hrZaP.J9mJRZiWfNp3s6l 4fsFUWlqHTaE6OXfhQ.lJFunwIulrDLsrC.UsmTAgjJ9L7RGXN6MNbWnf8G.fKl39ZeyRSnJrRSl lClKsj5I- Received: from sonicgw.mail.yahoo.co.jp by sonicconh6002.mail.ssk.yahoo.co.jp with HTTP; Fri, 6 Jan 2023 06:57:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1672988232; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:Subject:To:References:Cc:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=Ggf6WfuytMPXtBCnhY63HJsAlsdIY0ABU5bO/pnk43Q=; b=MGAprKsSj/IBw5kmloeh5A/GcZ49iYvgmds+IQZNU4VUBy00QnTOZCcJ+xuUCmqZ WY3nHGybqrwX64EQOQVL3ZVRVrvH1A99qVJyDCSJ77F9zLiULTZwMSjft+yl5Nr0hLK Mk3FDP7u1VcBWB9Q9wFlEHAkRoVi4JoMXZVjw5Yc= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:References:Cc:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=HvCyaiqu2qEJRhSkmyM+ARGbPT1UWyrSdO3944plJhqBszntnuFZVmVEsTDTdNYc kXo3N46jiPVEfdwiRsfdmPxAGgzTPqTYhhzmNmdS5nWMrFDUHUrE6ac8JUKvB873KJy U1YiAdUQtiBFNVRBoSpv1r5ERhTl0w84sxbAFIgs=; Received: by smtphe5003.mail.kks.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID 22ecb5206b7109174a192aea22869bf6; Fri, 06 Jan 2023 15:57:11 +0900 (JST) Message-ID: Date: Fri, 6 Jan 2023 15:57:09 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] xtensa: Optimize stack frame adjustment more To: Max Filippov References: <04a89dbf-c2a3-5dcb-8949-77569a1ad169.ref@yahoo.co.jp> <04a89dbf-c2a3-5dcb-8949-77569a1ad169@yahoo.co.jp> Cc: GCC Patches From: Takayuki 'January June' Suwa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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 2023/01/06 15:26, Max Filippov wrote: > On Thu, Jan 5, 2023 at 7:35 PM Takayuki 'January June' Suwa > wrote: >> On second thought, it cannot be a good idea to split addition/subtraction to the stack pointer. >> >>> - 4aaf: b0a192 movi a9, 0x1b0 >>> - 4ab2: 1f9a add.n a1, a15, a9 >> >>> + 4aaf: 02df12 addmi a1, a15, 0x200 >>> + 4ab2: b0c112 addi a1, a1, -80 >> >> Because the former is atomic, but the latter is not. (may be interrupted between the two add instructions) > > Oh, right, there are two issues: one is interruption in the absence of > detailed stack tracking in the DWARF info, which can be fixed by emitting > a separate note for each a1 change, the other is interruption when > a1 is in the parent frame, which can be fixed by always moving a1 > down first, e.g. with the following change: > > diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc > index 3b8a7bcda371..29cb91fa7de5 100644 > --- a/gcc/config/xtensa/xtensa.cc > +++ b/gcc/config/xtensa/xtensa.cc > @@ -2539,7 +2539,10 @@ xtensa_split_imm_two_addends (HOST_WIDE_INT > imm, HOST_WIDE_INT v[2]) > > if (xtensa_simm8 (v1) || xtensa_simm8x256 (v1)) > { > - v[0] = v0, v[1] = v1; > + if (v0 < 0) > + v[0] = v0, v[1] = v1; > + else > + v[0] = v1, v[1] = v0; > return true; > } > > Or both can be fixed by using a scratch register in the middle of the > addi/addmi sequence. > >> I'll wait for the results of your investigation, but it may be better to withdraw the patch. > > The issue was in the unwinding code in the libgcc_s.so. I haven't figured > out the exact mechanism, but found that emitting a separate note for each > a1 change fixes it. > Oh, thank you very much for your detailed investigation. I will try to correct what you pointed out ASAP.