From b1b92e72cdad1dc51058a26f1dadddd406fb8472 Mon Sep 17 00:00:00 2001 From: "From: Juzhe-Zhong" Date: Tue, 30 May 2023 10:16:09 +0800 Subject: [PATCH] RISC-V: Fix warning in riscv.md MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Juzhe-Zhong 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 aba203318a73..f545874edc13 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 (UINTVAL (operands[2]) == GET_MODE_MASK (HImode)) tmode = HImode; - else if (INTVAL (operands[2]) == GET_MODE_MASK (SImode)) + else if (UINTVAL (operands[2]) == GET_MODE_MASK (SImode)) tmode = SImode; if (tmode != VOIDmode) -- 2.47.2