diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md
index 1ed84850e351590c7a8ef05601baa5ce9d133901..d14b1ca30bb0e25b0b597b42dd272f20f99b1f8f 100644
--- a/gcc/config/riscv/predicates.md
+++ b/gcc/config/riscv/predicates.md
@@ -31,7 +31,7 @@
   (ior (match_operand 0 "arith_operand")
        (and (match_code "const_int")
             (match_test "INTVAL (op) == GET_MODE_MASK (HImode)
-			 || INTVAL (op) == GET_MODE_MASK (SImode)"))))
+			 || UINTVAL (op) == GET_MODE_MASK (SImode)"))))
 
 (define_predicate "lui_operand"
   (and (match_code "const_int")