]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Also allow FP conditions in `riscv_expand_conditional_move'
authorMaciej W. Rozycki <macro@embecosm.com>
Wed, 22 Nov 2023 01:18:29 +0000 (01:18 +0000)
committerMaciej W. Rozycki <macro@embecosm.com>
Wed, 22 Nov 2023 01:18:29 +0000 (01:18 +0000)
In `riscv_expand_conditional_move' we only let integer conditions
through at the moment, even though code has already been prepared to
handle floating-point conditions as well.

Lift this restriction and only bail out if a non-word-mode integer
condition has been requested, as we cannot handle this specific case
owing to machine instruction set restriction.  We already take care of
the non-integer, non-floating-point case later on.

gcc/
* config/riscv/riscv.cc (riscv_expand_conditional_move): Don't
bail out in floating-point conditions.

gcc/config/riscv/riscv.cc

index 14e549392912173e2f023a8e596481b8d355d415..ef6569ed15ff781cc1b03eb41eb29fa4147cb4b1 100644 (file)
@@ -4138,12 +4138,12 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
       machine_mode mode0 = GET_MODE (op0);
       machine_mode mode1 = GET_MODE (op1);
 
-      /* The comparison must be comparing WORD_MODE objects.   We must
-        enforce that so that we don't strip away a sign_extension
+      /* An integer comparison must be comparing WORD_MODE objects.  We
+        must enforce that so that we don't strip away a sign_extension
         thinking it is unnecessary.  We might consider using
         riscv_extend_operands if they are not already properly extended.  */
-      if ((mode0 != word_mode && mode0 != VOIDmode)
-         || (mode1 != word_mode && mode1 != VOIDmode))
+      if ((INTEGRAL_MODE_P (mode0) && mode0 != word_mode)
+         || (INTEGRAL_MODE_P (mode1) && mode1 != word_mode))
        return false;
 
       /* In the fallback generic case use MODE rather than WORD_MODE for