From patchwork Tue Jul 25 06:39:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jin Ma X-Patchwork-Id: 125346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2276060vqg; Mon, 24 Jul 2023 23:40:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHBgadLjLdyTTohlph1cDAIvQPvEEFhBBAsb/Dx0/BdoxyEmruSxQ9L+JVpW1PB4OILXwim X-Received: by 2002:a17:907:1624:b0:978:2b56:d76e with SMTP id hb36-20020a170907162400b009782b56d76emr1606755ejc.12.1690267212167; Mon, 24 Jul 2023 23:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690267212; cv=none; d=google.com; s=arc-20160816; b=cMw7vdbjCROpNr/K0y2OsJkwKjuT0tW/cHTzM5Bt/1WWq32++vTZC/GoYgSHRJmhwO MulexOBPuAkTFZa9xoeEh4ghJ089uHwa+TQstkr843P2CMxEiY5ULeluUU5hLWQKN7sr aBcATU4ZFoaD31ieUX4zHKWr4LjQIuqb5bim2kRwJUqIlPwwI6VQOBkJwpB71wS7iEXg EXi6d05uvSb5CWUboxuNgzuR9sgFUMlOaC0gnKhsStqJdS1Octd3AtbNUVs85LvT43ay sn09csT4C4aBjJaQNr1AgYmCwBE6uOVsDqHk/b/qRMtGg/UkhfuUjpO1lr5NMoA867uO 2goA== 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=wvhAQQrNfZQeltbJDIiRACeqnXg2ZKqRaytDebVf6Fc=; fh=j4+MXb+PWjkHgVFFfv8CwHdfztkq1cRLGlP5c/H2H5o=; b=GlCqzUT4pdVs8ZxlnHrNehT/+GeRerKEw+4TTDrAqXzmN4Xf0Vrv2aKFaRGtYN+Hkp R10GN6JgVgn932dDJemdtQi71eSXuwNPTni0fwkhv4XzGEoWhkVqrORCPkaux4m0cErZ GXK0R1RYlajWVFqaG131bEEraaBAxUVXsKtc3JFknbeEVD0ODyccri96q6jerGVFTR2H EXRH6isBzcL21IOGacvqbBQcPE1IVnp0qEOB2u1mZRuNQYLobIR5cmfqujqEudS7o01x bXCNg9JRuY+IwZCsAS1dwP8nrb4me/Oe5HiZaHVBYsxg8JNNtTicD63Er6g3tDMHqvsj DIIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=R4L2DOhG; 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 a10-20020a170906190a00b009885c5f1d7asi8480841eje.319.2023.07.24.23.40.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 23:40:12 -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=R4L2DOhG; 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 14448385734B for ; Tue, 25 Jul 2023 06:40:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14448385734B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690267210; bh=wvhAQQrNfZQeltbJDIiRACeqnXg2ZKqRaytDebVf6Fc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=R4L2DOhGzZKzGB3b8sc6vxBClmSGUalXEFcaa7VqQnRqunf+yUAlym0sHpJ1qSuqq 652sXnCIUxkdTIRz5bhBFGXWsU/g+0UBFpoRjWzpYD3GoW/K1HWU3jKnjncoIrifgn 5p6/dJ9re4tG0gb3O4UDpsgtEf/F+PJbfW6z4huQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by sourceware.org (Postfix) with ESMTPS id A4EFF3858C5F for ; Tue, 25 Jul 2023 06:39:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4EFF3858C5F X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R131e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046050; MF=jinma@linux.alibaba.com; NM=1; PH=DS; RN=8; SR=0; TI=SMTPD_---0VoC1Dxy_1690267159; Received: from localhost.localdomain(mailfrom:jinma@linux.alibaba.com fp:SMTPD_---0VoC1Dxy_1690267159) by smtp.aliyun-inc.com; Tue, 25 Jul 2023 14:39:21 +0800 To: gcc-patches@gcc.gnu.org Cc: jeffreyalaw@gmail.com, palmer@dabbelt.com, richard.sandiford@arm.com, kito.cheng@gmail.com, christoph.muellner@vrull.eu, jinma.contrib@gmail.com, Jin Ma Subject: [PATCH] RISC-V: Fixbug for fsflags instruction error using immediate. Date: Tue, 25 Jul 2023 14:39:10 +0800 Message-Id: <20230725063910.1568-1-jinma@linux.alibaba.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-20.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jin Ma via Gcc-patches From: Jin Ma Reply-To: Jin Ma Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772373631945382397 X-GMAIL-MSGID: 1772373631945382397 The pattern mistakenly believes that fsflags can use immediate numbers, but in fact it does not support it. Immediate numbers should use fsflagsi. For example: __builtin_riscv_fsflags(4); The following error occurred: /tmp/ccoWdWqT.s: Assembler messages: /tmp/ccoWdWqT.s:14: Error: illegal operands `fsflags 4' gcc/ChangeLog: * config/riscv/riscv.md: Likewise. --- gcc/config/riscv/riscv.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 4615e811947..1ec85e30d7e 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -3074,7 +3074,7 @@ (define_insn "riscv_frcsr" "frcsr\t%0") (define_insn "riscv_fscsr" - [(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FSCSR)] + [(unspec_volatile [(match_operand:SI 0 "csr_operand" "r")] UNSPECV_FSCSR)] "TARGET_HARD_FLOAT || TARGET_ZFINX" "fscsr\t%0") @@ -3085,9 +3085,11 @@ (define_insn "riscv_frflags" "frflags\t%0") (define_insn "riscv_fsflags" - [(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FSFLAGS)] + [(unspec_volatile [(match_operand:SI 0 "csr_operand" "r,K")] UNSPECV_FSFLAGS)] "TARGET_HARD_FLOAT || TARGET_ZFINX" - "fsflags\t%0") + "@ + fsflags\t%0 + fsflagsi\t%0") (define_insn "*riscv_fsnvsnan2" [(unspec_volatile [(match_operand:ANYF 0 "register_operand" "f")