https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114801

--- Comment #19 from Christophe Lyon <clyon at gcc dot gnu.org> ---
So basically values such as 0xcccc are not UB and we want to accept them.

I tested:
diff --git a/gcc/rtx-vector-builder.cc b/gcc/rtx-vector-builder.cc
index 9509d9fc453..f89aa717903 100644
--- a/gcc/rtx-vector-builder.cc
+++ b/gcc/rtx-vector-builder.cc
@@ -96,8 +96,6 @@ rtx_vector_builder::find_cached_value ()
        return CONSTM1_RTX (m_mode);
       else if (elt == const0_rtx)
        return CONST0_RTX (m_mode);
-      else
-       gcc_unreachable ();
     }

   /* We can be called before the global vector constants are set up,
diff --git a/gcc/config/arm/arm-mve-builtins.cc
b/gcc/config/arm/arm-mve-builtins.cc
index 6a5775c67e5..6dc0b603dad 100644
--- a/gcc/config/arm/arm-mve-builtins.cc
+++ b/gcc/config/arm/arm-mve-builtins.cc
@@ -2205,7 +2205,13 @@ function_expander::add_input_operand (insn_code icode,
rtx x)
       mode = GET_MODE (x);
     }
   else if (VALID_MVE_PRED_MODE (mode))
-    x = gen_lowpart (mode, x);
+    {
+      if (SUBREG_P (x))
+       /* gen_lowpart on a SUBREG can ICE.  */
+       x = force_reg (GET_MODE (x), x);
+
+      x = gen_lowpart (mode, x);
+    }

   m_ops.safe_grow (m_ops.length () + 1, true);
   create_input_operand (&m_ops.last (), x, mode);


And it works: we generate
mov     r2, #52428 for 0xcccc
mov     r3, #43690 for 0xaaaa

But I guess removing the call to gcc_unreachable breaks a strong assumption in
many places?

Reply via email to