This is at par with other major arches such as aarch64, i386, s390 ...

No testsuite regressions: same numbers w/ w/o

|               === gcc Summary ===
|
|# of expected passes           113392
|# of unexpected failures       27
|# of unexpected successes      3
|# of expected failures         605
|# of unsupported tests         2523
|
|               === g++ Summary ===
|
|# of expected passes           172997
|# of unexpected failures       26
|# of expected failures         706
|# of unsupported tests         9566

Signed-off-by: Vineet Gupta <vine...@rivosinc.com>
---
 gcc/config/riscv/predicates.md | 2 +-
 gcc/config/riscv/riscv.c       | 6 ++++++
 gcc/config/riscv/riscv.h       | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md
index 3da6fd4c0491..cf902229954b 100644
--- a/gcc/config/riscv/predicates.md
+++ b/gcc/config/riscv/predicates.md
@@ -52,7 +52,7 @@
        (match_test "INTVAL (op) + 1 != 0")))
 
 (define_predicate "const_0_operand"
-  (and (match_code "const_int,const_wide_int,const_double,const_vector")
+  (and (match_code "const_int,const_wide_int,const_vector")
        (match_test "op == CONST0_RTX (GET_MODE (op))")))
 
 (define_predicate "reg_or_0_operand"
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index c830cd8f4ad1..d2f2d9e0276f 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -1774,6 +1774,12 @@ riscv_rtx_costs (rtx x, machine_mode mode, int 
outer_code, int opno ATTRIBUTE_UN
     case SYMBOL_REF:
     case LABEL_REF:
     case CONST_DOUBLE:
+      /* With TARGET_SUPPORTS_WIDE_INT const int can't be in CONST_DOUBLE
+         rtl object. Weird recheck due to switch-case fall through above.  */
+      if (GET_CODE (x) == CONST_DOUBLE)
+        gcc_assert (GET_MODE (x) != VOIDmode);
+      /* Fall through.  */
+
     case CONST:
       if ((cost = riscv_const_insns (x)) > 0)
        {
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index ff6729aedac2..91cfc82b4aa4 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -997,4 +997,6 @@ extern void riscv_remove_unneeded_save_restore_calls (void);
 
 #define HARD_REGNO_RENAME_OK(FROM, TO) riscv_hard_regno_rename_ok (FROM, TO)
 
+#define TARGET_SUPPORTS_WIDE_INT 1
+
 #endif /* ! GCC_RISCV_H */
-- 
2.32.0

Reply via email to