]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[committed][RISC-V]Don't reject constants in cmov condition
authorJeff Law <jlaw@ventanamicro.com>
Mon, 7 Aug 2023 20:34:40 +0000 (14:34 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 7 Aug 2023 20:34:40 +0000 (14:34 -0600)
This test is too aggressive.  Constants have VOIDmode, so we need to let the
through this phase of conditional move support.

Fixes several missed conditional moves with the trunk.

gcc/
* config/riscv/riscv.cc (riscv_expand_conditional_move): Allow
VOIDmode operands to conditional before canonicalization.

gcc/config/riscv/riscv.cc

index 279304afc19b901306d2e44c529bf5236d65d699..5248dd3febe0a9d6431e8f7bdafc7ae545c483a0 100644 (file)
@@ -3582,7 +3582,8 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
         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 (GET_MODE (op0) != word_mode || GET_MODE (op1) != word_mode)
+      if ((GET_MODE (op0) != word_mode && GET_MODE (op0) != VOIDmode)
+         || (GET_MODE (op1) != word_mode && GET_MODE (op1) != VOIDmode))
        return false;
 
       /* Canonicalize the comparison.  It must be an equality comparison