public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix warning in riscv.md
@ 2023-05-30 13:57 Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-05-30 13:57 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6b651d6bdecc399edc1cf783cf7fcfe590668a5e

commit 6b651d6bdecc399edc1cf783cf7fcfe590668a5e
Author: From: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Tue May 30 10:16:09 2023 +0800

    RISC-V: Fix warning in riscv.md
    
    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 <juzhe.zhong@rivai.ai>
    
    gcc/ChangeLog:
    
            * config/riscv/riscv.md: Fix signed and unsigned comparison
            warning.

Diff:
---
 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..f545874edc1 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix warning in riscv.md
@ 2023-07-14  2:40 Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-07-14  2:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2eea5ba1b0156a40793262ce3da62e23eb1b9219

commit 2eea5ba1b0156a40793262ce3da62e23eb1b9219
Author: From: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Tue May 30 10:16:09 2023 +0800

    RISC-V: Fix warning in riscv.md
    
    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 <juzhe.zhong@rivai.ai>
    
    gcc/ChangeLog:
    
            * config/riscv/riscv.md: Fix signed and unsigned comparison
            warning.

Diff:
---
 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..f545874edc1 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-14  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 13:57 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix warning in riscv.md Jeff Law
2023-07-14  2:40 Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).