From patchwork Tue May 30 01:13:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 100463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1863509vqr; Mon, 29 May 2023 18:14:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5m+h6BEXioDDqXcxMZ1oPv3odKb/jd4i/vG8WKqileaYUDF6X0YZuCR1JCsIMnVRUtktLx X-Received: by 2002:a17:906:6a07:b0:973:dbcd:52d4 with SMTP id qw7-20020a1709066a0700b00973dbcd52d4mr925007ejc.37.1685409263601; Mon, 29 May 2023 18:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685409263; cv=none; d=google.com; s=arc-20160816; b=0QBd0F1bWP1yEPJ6Mry1ZUmE53/BB0iztBNf24jY5ec3CmIoYGRaroTonhfgabmh0o 198i5QuTKqgI0fxyYC3gVmrsM5fOYA4Fi6IbwV7ctMua0hJR6bPp8QmftPKQnWieuSnz Q5+b6HWcYYMcZtZTTp1L4+//atfqOnGU50p0LYB9nGvPdznwf7p+w550xgHPXoHRGShV TWMIqAW5Q3o0zH2krqdG7zJMmejle2KIj1Jf1pObTXxRxWDnck/KdSTfa2bHeOSbeTgl LerFQrwKfc6RegLrO+EPgpSMJ3XsosB8OsoYWLy9eqgk3uSEcE1bpNKA5EZKiKV8JaIr 3UwQ== 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:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=dVBjB6sUY9APMv8/TbEy/M5SUtAI8adTAvPZ8wT+xtk=; b=iVsNuETqNGXtPdz1HbXLhsYJHmmN2CeEL4ZEE2Mt4y0KzwBZ9AJ8NkTShPisLu2AWB 1uvK1owskDPw1O6OxAZep4xGeYeP1WOu1F3xIgw7KWW+Z7/t6zpPUWiUbIz6MMaa/5oc rMUd9a0R/iY6FdXYfHPgPvxe0ufKmSvwIFXNc0cUGQynvsobZJgdoYABUMPkAdM6rST1 HxEM9lwVjnqiQifnsnCH42GTonu7wE1ZdHexPkaRmkums68tFMHN39yDEdYRxV8LhVqo 0R9se3V9b9N3skQWWq70jC3DOGOH81RYzvNrCEd7Cp5PFl/3sC8L5BXwqm9N/v/pRdU7 zzuA== ARC-Authentication-Results: i=1; mx.google.com; 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" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s10-20020a170906c30a00b00966634ebd73si7945705ejz.571.2023.05.29.18.14.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 18:14: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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B80A3856973 for ; Tue, 30 May 2023 01:14:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) by sourceware.org (Postfix) with ESMTPS id 5AD133858C27 for ; Tue, 30 May 2023 01:13:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5AD133858C27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp86t1685409222taog42eu Received: from rios-cad5.localdomain ( [58.60.1.11]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 30 May 2023 09:13:41 +0800 (CST) X-QQ-SSF: 00400000000000F0R000000A0000000 X-QQ-FEAT: CR3LFp2JE4mZ+87oJAhucsaFVeoFKFi3jEYJZqXEWPyDFo7NP6IxvYIuaxhlL niSzhsXtgjHK/dBhsnNqkaAmREnzyYSvZ5OOY1pYTDQI/fOrMDmB0ZaqlPKApWM2sVE2WV4 J8LdTCz4671dcTV0aEEB1I2aoJk8zqN+38waT2LtfPA4BUXH4N/ha5Tncy+3BX24+X/SdeS Y8wBCH3y+WwlaQdFkJ+ViTMIzTrXB+uhpjH3LEUcYuBeGxovn1PvJsSA0fmT/RC9DHnPsqi bxlaFRBs9Z25m32usyv9OSNWd1a7HKWtycgwIRztL/Yci7x2WHZPUAOcP+/XE6e4ghfy6jF aFc76YKoPA3OfWqTPkR/rFgGxwWffwHsP0awjN7h5twjjIzyce8yvEl2CkFEg== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 3881481526910428461 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, palmer@dabbelt.com, palmer@rivosinc.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, Juzhe-Zhong Subject: [PATCH] RISC-V: Fix warning in riscv.md Date: Tue, 30 May 2023 09:13:39 +0800 Message-Id: <20230530011339.838303-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, MEDICAL_SUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767279703891407526?= X-GMAIL-MSGID: =?utf-8?q?1767279703891407526?= From: Juzhe-Zhong Notice there is warning: ../../../riscv-gcc/gcc/config/riscv/riscv.md:1356:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (INTVAL (operands[2]) == GET_MODE_MASK (HImode)) ../../../riscv-gcc/gcc/config/riscv/riscv.md:1358:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] else if (INTVAL (operands[2]) == GET_MODE_MASK (SImode)) ../../../riscv-gcc/gcc/config/riscv/riscv.md: In function ‘rtx_def* gen_anddi3(rtx, rtx, rtx)’: ../../../riscv-gcc/gcc/config/riscv/riscv.md:1356:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (INTVAL (operands[2]) == GET_MODE_MASK (HImode)) ../../../riscv-gcc/gcc/config/riscv/riscv.md:1358:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] else if (INTVAL (operands[2]) == GET_MODE_MASK (SImode)) Add unsigned conversion to fix this warning. gcc/ChangeLog: * config/riscv/riscv.md: Fix signed and unsigned comparison warning. --- gcc/config/riscv/riscv.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index aba203318a7..3d71f59c3a9 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1353,9 +1353,9 @@ if (CONST_INT_P (operands[2])) { enum machine_mode tmode = VOIDmode; - if (INTVAL (operands[2]) == GET_MODE_MASK (HImode)) + if ((unsigned HOST_WIDE_INT) INTVAL (operands[2]) == GET_MODE_MASK (HImode)) tmode = HImode; - else if (INTVAL (operands[2]) == GET_MODE_MASK (SImode)) + else if ((unsigned HOST_WIDE_INT) INTVAL (operands[2]) == GET_MODE_MASK (SImode)) tmode = SImode; if (tmode != VOIDmode)