Message ID | 20230913060630.3930824-1-pan2.li@intel.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp879767vqx; Tue, 12 Sep 2023 23:07:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnX1DM8q0hMO46U8FItNgcYP4TWLdB35uUWFvaIeWZVcZqPKu+eQGdNpb+YOU61Y82o1Pz X-Received: by 2002:a50:ee94:0:b0:52e:5b10:23ac with SMTP id f20-20020a50ee94000000b0052e5b1023acmr1249209edr.36.1694585243217; Tue, 12 Sep 2023 23:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694585243; cv=none; d=google.com; s=arc-20160816; b=mlXm0KFz6+csjt9IUBV5lBtL68LFaJ8JK/9FNbOQcxwK4PRwz3jzlDD7DT5bnRQTgN hYSBYYjgph/gANNHK+ttixmitNyBDCWqpRi6GAcDS5qd1USchJKO+kpa/OIiV190g1xR zQCWJiEC8/7pgwjSsXR1ETtCxm2fV2LWbAMQrcfhsPECZd3PWvXUAyrqABRVtpVZbDIp lYSN15WCGtwCz+er6DIDnSyuC44kLXFyMIQhOOd97beTKgal5YKsX36SclDVNksxxqGp caX/NJ7AG9SxGUHfC2wU+qqt0DVNFzhYkhvKaD2qttS/kZNPflpJRYM1Jm5CSmCQ77ws 2IHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=HMVMaP3f2W4cS+piqGUppifeHdMZlL/NTPxap2J8qv8=; fh=yqBQmCEeFYB2Wjmf8l8QkV/dOy5iKwSEx/iU/FYQjxU=; b=EMaP8RnRyRlYv+cnzv5FMDMZU0NkNp6i1GSzIh6tory+VJv9zMu1L4ZC436ULsypeL GsNfQ7SWIx83MZW4/fkMGXC4g3eVcowEFxCvAEH8SAXN1g86KJnyzubXj1/KcWNDkboA 9X5q63P9TXBo9AC0vp0zqrrPnBl21XFZC7/RgWcoWqUzQbByAG8MOjvCsDzOynIBR7p4 jLlz0vd4oJbTre4HzvUInzKsKOppcUBm9nRJIPqA65qdbZFx8F8cTvJPdRGhUcE0Kmzs CiGk39Mh+YSq2+Xo41LZmPs3/vObkvifHGydht0yl6ytCDwXGe11nfNNb/6ItlZAfvhn EU9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kUbRuIm1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f16-20020a056402195000b0052fc773a47bsi970142edz.690.2023.09.12.23.07.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 23:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kUbRuIm1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E93A5385DC17 for <ouuuleilei@gmail.com>; Wed, 13 Sep 2023 06:07:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E93A5385DC17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694585240; bh=HMVMaP3f2W4cS+piqGUppifeHdMZlL/NTPxap2J8qv8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=kUbRuIm1CTcdZLWRwJ25xe26u7lGLx72l4M7GscIVqRw6JvH3cFRgr/L/DopQRe/U g2A9jKa32+X09LHxbcBuGgjjZ/NVcCZ8QSYP9el99DRejGJP+NaipbZOnnOtLIeCI8 NptKxnr9JO8pKvmY9bt/j7BxuQ2XFYrSzJv+atkM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by sourceware.org (Postfix) with ESMTPS id 725EB3858281 for <gcc-patches@gcc.gnu.org>; Wed, 13 Sep 2023 06:06:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 725EB3858281 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="358848223" X-IronPort-AV: E=Sophos;i="6.02,142,1688454000"; d="scan'208";a="358848223" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 23:06:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="917705862" X-IronPort-AV: E=Sophos;i="6.02,142,1688454000"; d="scan'208";a="917705862" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orsmga005.jf.intel.com with ESMTP; 12 Sep 2023 23:06:32 -0700 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 12EA8100568B; Wed, 13 Sep 2023 14:06:32 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, pan2.li@intel.com, yanzhang.wang@intel.com, kito.cheng@gmail.com Subject: [PATCH v1] RISC-V: Bugfix PR111362 for incorrect frm emit Date: Wed, 13 Sep 2023 14:06:30 +0800 Message-Id: <20230913060630.3930824-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 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> From: Pan Li via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: pan2.li@intel.com 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: INBOX X-GMAIL-THRID: 1776901416414665866 X-GMAIL-MSGID: 1776901416414665866 |
Series |
[v1] RISC-V: Bugfix PR111362 for incorrect frm emit
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Li, Pan2 via Gcc-patches
Sept. 13, 2023, 6:06 a.m. UTC
From: Pan Li <pan2.li@intel.com> When the mode switching from NONE to CALL, we will restore the frm but lack some check if we have static frm insn in cfun. This patch would like to fix this by adding static frm insn check. gcc/ChangeLog: * PR target/111362 * config/riscv/riscv.cc (riscv_emit_frm_mode_set): Bugfix. gcc/testsuite/ChangeLog: * PR target/111362 * gcc.target/riscv/rvv/base/no-honor-frm-1.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com> --- gcc/config/riscv/riscv.cc | 2 +- .../gcc.target/riscv/rvv/base/no-honor-frm-1.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c
Comments
LGTM :) On Wed, Sep 13, 2023 at 2:07 PM Pan Li via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > From: Pan Li <pan2.li@intel.com> > > When the mode switching from NONE to CALL, we will restore the > frm but lack some check if we have static frm insn in cfun. > > This patch would like to fix this by adding static frm insn check. > > gcc/ChangeLog: > > * PR target/111362 > * config/riscv/riscv.cc (riscv_emit_frm_mode_set): Bugfix. > > gcc/testsuite/ChangeLog: > > * PR target/111362 > * gcc.target/riscv/rvv/base/no-honor-frm-1.c: New test. > > Signed-off-by: Pan Li <pan2.li@intel.com> > --- > gcc/config/riscv/riscv.cc | 2 +- > .../gcc.target/riscv/rvv/base/no-honor-frm-1.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > index 9d04ddd69e0..762937b0e37 100644 > --- a/gcc/config/riscv/riscv.cc > +++ b/gcc/config/riscv/riscv.cc > @@ -9173,7 +9173,7 @@ riscv_emit_frm_mode_set (int mode, int prev_mode) > rtx frm = gen_int_mode (mode, SImode); > > if (mode == riscv_vector::FRM_DYN_CALL > - && prev_mode != riscv_vector::FRM_DYN) > + && prev_mode != riscv_vector::FRM_DYN && STATIC_FRM_P (cfun)) > /* No need to emit when prev mode is DYN already. */ > emit_insn (gen_fsrmsi_restore_volatile (backup_reg)); > else if (mode == riscv_vector::FRM_DYN_EXIT && STATIC_FRM_P (cfun) > diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c > new file mode 100644 > index 00000000000..b2e0f217bfa > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c > @@ -0,0 +1,12 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ > + > +void foo (void) { > + for (unsigned i = 0; i < sizeof(foo); i++) > + __builtin_printf("%d", i); > +} > + > +/* { dg-final { scan-assembler-not {fsrmi\s+[axs][0-9]+,\s*[01234]} } } */ > +/* { dg-final { scan-assembler-not {fsrmi\s+[01234]} } } */ > +/* { dg-final { scan-assembler-not {fsrm\s+[axs][0-9]+} } } */ > +/* { dg-final { scan-assembler-not {frrm\s+[axs][0-9]+} } } */ > -- > 2.34.1 >
Committed, thanks Kito. Pan -----Original Message----- From: Kito Cheng <kito.cheng@gmail.com> Sent: Wednesday, September 13, 2023 2:16 PM To: Li, Pan2 <pan2.li@intel.com> Cc: gcc-patches@gcc.gnu.org; juzhe.zhong@rivai.ai; Wang, Yanzhang <yanzhang.wang@intel.com> Subject: Re: [PATCH v1] RISC-V: Bugfix PR111362 for incorrect frm emit LGTM :) On Wed, Sep 13, 2023 at 2:07 PM Pan Li via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > From: Pan Li <pan2.li@intel.com> > > When the mode switching from NONE to CALL, we will restore the > frm but lack some check if we have static frm insn in cfun. > > This patch would like to fix this by adding static frm insn check. > > gcc/ChangeLog: > > * PR target/111362 > * config/riscv/riscv.cc (riscv_emit_frm_mode_set): Bugfix. > > gcc/testsuite/ChangeLog: > > * PR target/111362 > * gcc.target/riscv/rvv/base/no-honor-frm-1.c: New test. > > Signed-off-by: Pan Li <pan2.li@intel.com> > --- > gcc/config/riscv/riscv.cc | 2 +- > .../gcc.target/riscv/rvv/base/no-honor-frm-1.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > index 9d04ddd69e0..762937b0e37 100644 > --- a/gcc/config/riscv/riscv.cc > +++ b/gcc/config/riscv/riscv.cc > @@ -9173,7 +9173,7 @@ riscv_emit_frm_mode_set (int mode, int prev_mode) > rtx frm = gen_int_mode (mode, SImode); > > if (mode == riscv_vector::FRM_DYN_CALL > - && prev_mode != riscv_vector::FRM_DYN) > + && prev_mode != riscv_vector::FRM_DYN && STATIC_FRM_P (cfun)) > /* No need to emit when prev mode is DYN already. */ > emit_insn (gen_fsrmsi_restore_volatile (backup_reg)); > else if (mode == riscv_vector::FRM_DYN_EXIT && STATIC_FRM_P (cfun) > diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c > new file mode 100644 > index 00000000000..b2e0f217bfa > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c > @@ -0,0 +1,12 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ > + > +void foo (void) { > + for (unsigned i = 0; i < sizeof(foo); i++) > + __builtin_printf("%d", i); > +} > + > +/* { dg-final { scan-assembler-not {fsrmi\s+[axs][0-9]+,\s*[01234]} } } */ > +/* { dg-final { scan-assembler-not {fsrmi\s+[01234]} } } */ > +/* { dg-final { scan-assembler-not {fsrm\s+[axs][0-9]+} } } */ > +/* { dg-final { scan-assembler-not {frrm\s+[axs][0-9]+} } } */ > -- > 2.34.1 >
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 9d04ddd69e0..762937b0e37 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -9173,7 +9173,7 @@ riscv_emit_frm_mode_set (int mode, int prev_mode) rtx frm = gen_int_mode (mode, SImode); if (mode == riscv_vector::FRM_DYN_CALL - && prev_mode != riscv_vector::FRM_DYN) + && prev_mode != riscv_vector::FRM_DYN && STATIC_FRM_P (cfun)) /* No need to emit when prev mode is DYN already. */ emit_insn (gen_fsrmsi_restore_volatile (backup_reg)); else if (mode == riscv_vector::FRM_DYN_EXIT && STATIC_FRM_P (cfun) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c new file mode 100644 index 00000000000..b2e0f217bfa --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/no-honor-frm-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ + +void foo (void) { + for (unsigned i = 0; i < sizeof(foo); i++) + __builtin_printf("%d", i); +} + +/* { dg-final { scan-assembler-not {fsrmi\s+[axs][0-9]+,\s*[01234]} } } */ +/* { dg-final { scan-assembler-not {fsrmi\s+[01234]} } } */ +/* { dg-final { scan-assembler-not {fsrm\s+[axs][0-9]+} } } */ +/* { dg-final { scan-assembler-not {frrm\s+[axs][0-9]+} } } */