Message ID | 20230602104247.26454-1-gaofei@eswincomputing.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp931517vqr; Fri, 2 Jun 2023 03:43:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6oJ/mZpwN4xWctlY5ZKXn45BmkRJvmaGtceN14M7db68CcVm45XBcZH19T1plann5/39lS X-Received: by 2002:a50:ed03:0:b0:508:3b1f:e6b5 with SMTP id j3-20020a50ed03000000b005083b1fe6b5mr1543110eds.15.1685702638839; Fri, 02 Jun 2023 03:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685702638; cv=none; d=google.com; s=arc-20160816; b=RprapgUc6QRxOD9H98h2nmRmWT+M5PePodIpr/QwxwehSUTpY9Brwu/Wf8ciuSY0DL H+6z2Eyi/ArsHugUQKvnZWDv98PdwrE7EJ1hWnnzuC+hMt4HJILSa7R9Arr70fMgfHGn /MMm1SJvusidXJ6oYetxQUJGtBVZXwrKZ8eQOyHg+8denDrespOCosmxXk0lDHARBu09 3yx2U/WM3+z7qVj+Dm2naNEQdq+F+Wb7ojBkgZ1SEnYHMBJqG9Zbv1RmM87U4Cvtaq6K 0oj81dIP6iVSNlYnq0Bnahjh8zKT5XBtIc2tpTFN716yJ+ggGLVMnbvQrOl0OOJMQRtW fkcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:cc:to :from:dmarc-filter:delivered-to; bh=StJZEHKypEDxWXrzcVIRG4UY0sHZMgrG36amqaMGMMM=; b=I8cNr0jqCZReMHYvvN/8m/+LOSrpvNS5xSpjwj9qfhJ3948VvgU8t8bmz1HR0vmkx4 BXednMaHUSTkT0KPLTejzopNJ2LuVXfYBTkElLFJ4vXp9EKGQUp3TNVrpEumGDKC2+6j 1Or0tCrh3308YcQYwrw7mn77A+Hfl6QFYwmy7hiZF7+lVAkeaw6Rwnw1fuBZIVPKFcKp K0LAqAKaS7nIvNHJEJIXgd4PYAZecfwDnC5cxuRxJG3w8cRebisXxKhpKI5mzASPKm5o QI4Ooyb472yavBv6ZHXLC6gFvnpv0hvHfN6rMBFNPIp1IpDkYh5UlKC2qHdWIDXJk0z+ G8YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g21-20020a056402181500b0050bc5ffdee1si620900edy.462.2023.06.02.03.43.58 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 03:43:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6300C38558A7 for <ouuuleilei@gmail.com>; Fri, 2 Jun 2023 10:43:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from zg8tmtu5ljg5lje1ms4xmtka.icoremail.net (zg8tmtu5ljg5lje1ms4xmtka.icoremail.net [159.89.151.119]) by sourceware.org (Postfix) with ESMTP id B77BE385771B for <gcc-patches@gcc.gnu.org>; Fri, 2 Jun 2023 10:43:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B77BE385771B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com Received: from localhost.localdomain (unknown [10.12.130.31]) by app1 (Coremail) with SMTP id EwgMCgC3VMTCx3lkBfAgAA--.10958S4; Fri, 02 Jun 2023 18:43:14 +0800 (CST) From: Fei Gao <gaofei@eswincomputing.com> To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com, sinan.lin@linux.alibaba.com, jiawei@iscas.ac.cn, Fei Gao <gaofei@eswincomputing.com> Subject: [PATCH 1/2] [RISC-V] fix cfi issue in save-restore. Date: Fri, 2 Jun 2023 10:42:46 +0000 Message-Id: <20230602104247.26454-1-gaofei@eswincomputing.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: EwgMCgC3VMTCx3lkBfAgAA--.10958S4 X-Coremail-Antispam: 1UD129KBjvJXoWxJryDKw18Kw4fuw13XryfXrb_yoW8urykpF s8XrySyr4rA3Wftw4ktFs3Ga4rGwnxGw45Wws8A34xA3yUCryDJa9Ika17uw1vqaykCr93 urn0kF1Ivw48AFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkI14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK6svPMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8Jw CI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2 z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbXdbUUUUUU== X-CM-SenderInfo: xjdrwv3l6h245lqf0zpsxwx03jof0z/ X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767587330439468009?= X-GMAIL-MSGID: =?utf-8?q?1767587330439468009?= |
Series |
[1/2,RISC-V] fix cfi issue in save-restore.
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Fei Gao
June 2, 2023, 10:42 a.m. UTC
This patch fixes a cfi issue introduced by https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=60524be1e3929d83e15fceac6e2aa053c8a6fb20 Test code: char my_getchar(); float getf(); int test_f0() { int s0 = my_getchar(); float f0 = getf(); int b = my_getchar(); return f0+s0+b; } cflags: -g -Os -march=rv32imafc -mabi=ilp32f -msave-restore -mcmodel=medlow before patch: test_f0: ... .cfi_startproc call t0,__riscv_save_1 .cfi_offset 8, -8 .cfi_offset 1, -4 .cfi_def_cfa_offset 16 ... addi sp,sp,-16 .cfi_def_cfa_offset 32 ... addi sp,sp,16 .cfi_def_cfa_offset 0 // issue here ... tail __riscv_restore_1 .cfi_restore 8 .cfi_restore 1 .cfi_def_cfa_offset -16 // issue here .cfi_endproc after patch: test_f0: ... .cfi_startproc call t0,__riscv_save_1 .cfi_offset 8, -8 .cfi_offset 1, -4 .cfi_def_cfa_offset 16 ... addi sp,sp,-16 .cfi_def_cfa_offset 32 ... addi sp,sp,16 .cfi_def_cfa_offset 16 // corrected here ... tail __riscv_restore_1 .cfi_restore 8 .cfi_restore 1 .cfi_def_cfa_offset 0 // corrected here .cfi_endproc gcc/ChangeLog: * config/riscv/riscv.cc (riscv_expand_epilogue): fix cfi issue with correct offset. --- gcc/config/riscv/riscv.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 6/2/23 04:42, Fei Gao wrote: > This patch fixes a cfi issue introduced by > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=60524be1e3929d83e15fceac6e2aa053c8a6fb20 > > Test code: > char my_getchar(); > float getf(); > int test_f0() > { > int s0 = my_getchar(); > float f0 = getf(); > int b = my_getchar(); > return f0+s0+b; > } > > cflags: -g -Os -march=rv32imafc -mabi=ilp32f -msave-restore -mcmodel=medlow > > before patch: > test_f0: > ... > .cfi_startproc > call t0,__riscv_save_1 > .cfi_offset 8, -8 > .cfi_offset 1, -4 > .cfi_def_cfa_offset 16 > ... > addi sp,sp,-16 > .cfi_def_cfa_offset 32 > > ... > > addi sp,sp,16 > .cfi_def_cfa_offset 0 // issue here > ... > tail __riscv_restore_1 > .cfi_restore 8 > .cfi_restore 1 > .cfi_def_cfa_offset -16 // issue here > .cfi_endproc > > after patch: > test_f0: > ... > .cfi_startproc > call t0,__riscv_save_1 > .cfi_offset 8, -8 > .cfi_offset 1, -4 > .cfi_def_cfa_offset 16 > ... > addi sp,sp,-16 > .cfi_def_cfa_offset 32 > > ... > > addi sp,sp,16 > .cfi_def_cfa_offset 16 // corrected here > ... > tail __riscv_restore_1 > .cfi_restore 8 > .cfi_restore 1 > .cfi_def_cfa_offset 0 // corrected here > .cfi_endproc > > gcc/ChangeLog: > > * config/riscv/riscv.cc (riscv_expand_epilogue): fix cfi issue with correct offset. I fixed a trivial whitespace problem, rewrapped the ChangeLog and pushed this patch to the trunk. Please consider adding a testcase for this bug to the testsuite. jeff
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 85db1e3c86b..469af02bdf7 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -5652,7 +5652,7 @@ riscv_expand_epilogue (int style) adjust)); rtx dwarf = NULL_RTX; rtx cfa_adjust_rtx = gen_rtx_PLUS (Pmode, stack_pointer_rtx, - GEN_INT (step2)); + GEN_INT (step2 + libcall_size)); dwarf = alloc_reg_note (REG_CFA_DEF_CFA, cfa_adjust_rtx, dwarf); RTX_FRAME_RELATED_P (insn) = 1; @@ -5689,7 +5689,7 @@ riscv_expand_epilogue (int style) rtx dwarf = NULL_RTX; rtx cfa_adjust_rtx = gen_rtx_PLUS (Pmode, stack_pointer_rtx, - const0_rtx); + GEN_INT (libcall_size )); dwarf = alloc_reg_note (REG_CFA_DEF_CFA, cfa_adjust_rtx, dwarf); RTX_FRAME_RELATED_P (insn) = 1;