RISC-V: THEAD: Fix improper immediate value for MODIFY_DISP instruction on 32-bit systems.
Message ID | 20240129092016.1176-1-jinma@linux.alibaba.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp447981dyb; Mon, 29 Jan 2024 01:21:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGY4dSMw8BK9uqynanZxkKAenUgdHPZV9s+Sl6FQll92dCq9M3oQ5BQpJbjwNEbhPRELUne X-Received: by 2002:a05:620a:2182:b0:783:c579:c246 with SMTP id g2-20020a05620a218200b00783c579c246mr5605791qka.45.1706520075615; Mon, 29 Jan 2024 01:21:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706520075; cv=pass; d=google.com; s=arc-20160816; b=k/KSoa43gusbpoS/C0AC+Aq/RNf8VTAbj62pV//ejFYSmHNXnI7Q6j/+DJvmE9N1mj wAqefxeC+ZF043o79ZBGAWUs9X1nlRWRAvMqYNQsQ805ttL4soozpvZ/Weg7rpqtLq9z 9xaGn07zUEriakaLPJpl5SccpJyjTHPI0B9vXaj2UbvC/2hh2e58z0wco8ffLwa3fOdu 9o2DM00j2z20NCGcjceHwyG6xDktugArBdseL+uWJ0FM+gliLbQImiGWwP2G9QwpOrU9 J6LHjbx0jot0DhfOhdMnNxUzkFAAo8hhgUAo/+iUuTARhogEkRKXcfVtA5CDmnGSEQsP rK1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=dFM1pbgQC5dwSMOK/4WHzgL2+5dEOJs2GgXRyqEn+yw=; fh=NKyge7LX4KSt+KPp8DZphs9pYKHErO4kHCbDx33dH3c=; b=ienaVOeQ7Di6RMEsdHtUFf6DZIeNlEE80Lmn1CoMkw8stFzT0DLD0rltYhwk6y+9SD hGpl2LVLzcHpxCQY7sX2PD17X6sg/acU0vbRXRRj9WouigmHBlaxt7loEQTdLVCgy1ce H7uF0lEIzpEceHE6Kx+Uq/H3HlowwqlXGlMAs/JF0Q2oK302v88Qf1Ko1ttz4lfxGDhb egtF059NCr3VUtcsXQg89ns1eXWVLjeINsYCpO+lbICSBl3N2k4IA4z7yQUWkPOEjqqy jFImfvzZsxVU4vOrXzlUcJB5pbmelelDDV19Aot2RPJAfv4JyK6ulvXLZO/SKTfI/FHl 8sNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=ZthNpKg1; arc=pass (i=1); 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=linux.alibaba.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id oq47-20020a05620a612f00b00783a2469a57si6962571qkn.340.2024.01.29.01.21.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 01:21:15 -0800 (PST) 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=@linux.alibaba.com header.s=default header.b=ZthNpKg1; arc=pass (i=1); 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=linux.alibaba.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51557385829D for <ouuuleilei@gmail.com>; Mon, 29 Jan 2024 09:21:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by sourceware.org (Postfix) with ESMTPS id B095E3858407 for <gcc-patches@gcc.gnu.org>; Mon, 29 Jan 2024 09:20:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B095E3858407 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.alibaba.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B095E3858407 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=115.124.30.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706520035; cv=none; b=YV75Zrh7IEiKQLbOol+94Wa54pD5c5hiep3M0uzB07XIVbidxLr/wA9xd6Vd/1BBoiA6SoCRFv7q7tvqy1KonwKB6VtIHOWU9xw3t12cJo0Rn3FAX/krn+ug0UyplyeTtCoBFq/hSulRbM3FT5TAcXOWKMtgsW1WQmQf1G7aX6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706520035; c=relaxed/simple; bh=U4k9RPUxFXOEqfQwwBmtS2tGKpMPFKxtvLKJhSg3/z0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=B9LT3tj81WLljrap6eLCpZhZOX+qrH6KXoY51zk9mGxf9c3Z7krDI2nHE9N2GIuoEml1qJzHOLmj45kUEK4mJMRKK5v7vYLkWaQmMiFF6wdP9xwvAy3ohbc5V6i6/2mgrO+qxIsuR+hkF4Qeak9zkXTfyYP4l2ygpZT/wDNXT+E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1706520029; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=dFM1pbgQC5dwSMOK/4WHzgL2+5dEOJs2GgXRyqEn+yw=; b=ZthNpKg1kHPKDlz66UqWZsC/bhtJ0+9eDlG4pTNMI7zOtZ1h2n3dEmHZlqOas7bVq5S6BmCFOOB82t/mJ3fpwz7WojsnNXD8JoNmmK3I+tWThXxisFkC4Q0u+73zD9gF51rJ2sDYVMlUXI2q8MIX5sf6/z27Ph1Z2WyjpbcslNE= X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R151e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045192; MF=jinma@linux.alibaba.com; NM=1; PH=DS; RN=10; SR=0; TI=SMTPD_---0W.Ziigt_1706520025; Received: from localhost.localdomain(mailfrom:jinma@linux.alibaba.com fp:SMTPD_---0W.Ziigt_1706520025) by smtp.aliyun-inc.com; Mon, 29 Jan 2024 17:20:27 +0800 From: Jin Ma <jinma@linux.alibaba.com> 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, rdapp.gcc@gmail.com, juzhe.zhong@rivai.ai, jinma.contrib@gmail.com, Jin Ma <jinma@linux.alibaba.com> Subject: [PATCH] RISC-V: THEAD: Fix improper immediate value for MODIFY_DISP instruction on 32-bit systems. Date: Mon, 29 Jan 2024 17:20:16 +0800 Message-Id: <20240129092016.1176-1-jinma@linux.alibaba.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-29.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL, 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.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> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789415994944222065 X-GMAIL-MSGID: 1789415994944222065 |
Series |
RISC-V: THEAD: Fix improper immediate value for MODIFY_DISP instruction on 32-bit systems.
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jin Ma
Jan. 29, 2024, 9:20 a.m. UTC
When using '%ld' to print 'long long int' variable, 'fprintf' will produce messy output on a 32-bit system, in an incorrect instruction being generated, such as 'th.lwib a1,(a0),-16,4294967295'. And the following error occurred during compilation: Assembler messages: Error: improper immediate value (18446744073709551615) gcc/ChangeLog: * config/riscv/thead.cc (th_print_operand_address): Change %ld to %lld. --- gcc/config/riscv/thead.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Jan 29, 2024 at 1:21 AM Jin Ma <jinma@linux.alibaba.com> wrote: > > When using '%ld' to print 'long long int' variable, 'fprintf' will > produce messy output on a 32-bit system, in an incorrect instruction > being generated, such as 'th.lwib a1,(a0),-16,4294967295'. And the > following error occurred during compilation: > > Assembler messages: > Error: improper immediate value (18446744073709551615) > > gcc/ChangeLog: > > * config/riscv/thead.cc (th_print_operand_address): Change %ld > to %lld. > --- > gcc/config/riscv/thead.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/config/riscv/thead.cc b/gcc/config/riscv/thead.cc > index 2955bc5f8a9..9ee6444b627 100644 > --- a/gcc/config/riscv/thead.cc > +++ b/gcc/config/riscv/thead.cc > @@ -1141,7 +1141,7 @@ th_print_operand_address (FILE *file, machine_mode mode, rtx x) > return true; > > case ADDRESS_REG_WB: > - fprintf (file, "(%s),%ld,%u", reg_names[REGNO (addr.reg)], > + fprintf (file, "(%s),%lld,%u", reg_names[REGNO (addr.reg)], > INTVAL (addr.offset) >> addr.shift, addr.shift); This is wrong, you should instead use HOST_WIDE_INT_PRINT_DEC or HOST_WIDE_INT_PRINT_UNSIGNED. Thanks, Andrew Pinski > return true; > > -- > 2.17.1 >
>On Mon, Jan 29, 2024 at 1:21=E2=80=AFAM Jin Ma <jinma@linux.alibaba.com> wr= >ote: >> >> When using '%ld' to print 'long long int' variable, 'fprintf' will >> produce messy output on a 32-bit system, in an incorrect instruction >> being generated, such as 'th.lwib a1,(a0),-16,4294967295'. And the >> following error occurred during compilation: >> >> Assembler messages: >> Error: improper immediate value (18446744073709551615) >> >> gcc/ChangeLog: >> >> * config/riscv/thead.cc (th_print_operand_address): Change %ld >> to %lld. >> --- >> gcc/config/riscv/thead.cc | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gcc/config/riscv/thead.cc b/gcc/config/riscv/thead.cc >> index 2955bc5f8a9..9ee6444b627 100644 >> --- a/gcc/config/riscv/thead.cc >> +++ b/gcc/config/riscv/thead.cc >> @@ -1141,7 +1141,7 @@ th_print_operand_address (FILE *file, machine_mode = >mode, rtx x) >> return true; >> >> case ADDRESS_REG_WB: >> - fprintf (file, "(%s),%ld,%u", reg_names[REGNO (addr.reg)], >> + fprintf (file, "(%s),%lld,%u", reg_names[REGNO (addr.reg)], >> INTVAL (addr.offset) >> addr.shift, addr.shift); >This is wrong, you should instead use HOST_WIDE_INT_PRINT_DEC or >HOST_WIDE_INT_PRINT_UNSIGNED. >Thanks, >Andrew Pinski Yes, thank you very much for your guidance. It will be better to use HOST_WIDE_INT_PRINT_DEC. I will make changes later :) BR Jin >> return true;
diff --git a/gcc/config/riscv/thead.cc b/gcc/config/riscv/thead.cc index 2955bc5f8a9..9ee6444b627 100644 --- a/gcc/config/riscv/thead.cc +++ b/gcc/config/riscv/thead.cc @@ -1141,7 +1141,7 @@ th_print_operand_address (FILE *file, machine_mode mode, rtx x) return true; case ADDRESS_REG_WB: - fprintf (file, "(%s),%ld,%u", reg_names[REGNO (addr.reg)], + fprintf (file, "(%s),%lld,%u", reg_names[REGNO (addr.reg)], INTVAL (addr.offset) >> addr.shift, addr.shift); return true;