]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Enable TARGET_SUPPORTS_WIDE_INT
authorVineet Gupta <vineetg@rivosinc.com>
Mon, 23 May 2022 23:25:39 +0000 (16:25 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 23 May 2022 23:32:10 +0000 (16:32 -0700)
This is at par with other major arches such as aarch64, i386, s390 ...

gcc/ChangeLog

* config/riscv/predicates.md (const_0_operand): Remove
const_double.
* config/riscv/riscv.cc (riscv_rtx_costs): Add check for
CONST_DOUBLE.
* config/riscv/riscv.h (TARGET_SUPPORTS_WIDE_INT): New define.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
gcc/config/riscv/predicates.md
gcc/config/riscv/riscv.cc
gcc/config/riscv/riscv.h

index 97cdbdf053b00b7793b1dd47d763bc42381edcf6..40c1c720f1dac5bb7f4372c4d03d83f5ee12de5d 100644 (file)
@@ -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"
index ee756aab69403357661c46243ed9ee1e81520f39..fb6621464ea263760396fd7eb3b6eaff81c1a8f8 100644 (file)
@@ -1797,6 +1797,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)
        {
index b191606edb4bc467e1e94e2ba1cdf506ba670886..5083a1c24b08233810dd3b2aa4278b3ef8a75791 100644 (file)
@@ -1009,4 +1009,6 @@ extern void riscv_remove_unneeded_save_restore_calls (void);
 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
   ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
 
+#define TARGET_SUPPORTS_WIDE_INT 1
+
 #endif /* ! GCC_RISCV_H */