bootstrapped / regtested on i686-pc-linux-gnu.
2013-11-08  Joern Rennecke  <joern.renne...@embecosm.com>

        PR middle-end/59049
        * expmed.c (emit_cstore): Avoid generating a comparison of two
        VOIDmode constants.

Index: gcc/expmed.c
===================================================================
--- gcc/expmed.c        (revision 204568)
+++ gcc/expmed.c        (working copy)
@@ -5112,6 +5112,12 @@ emit_cstore (rtx target, enum insn_code
   if (!target)
     target = gen_reg_rtx (target_mode);
 
+  /* If we compare two VOIDmode constants, we loose the mode to do the
+     comparison in.  To avoid that, copy one constant into a register.
+     We rely on subsequent optimizations (like ce1) to clean this up.  */
+  if (GET_MODE (x) == VOIDmode && GET_MODE (y) == VOIDmode)
+    x = copy_to_mode_reg (compare_mode, x);
+
   comparison = gen_rtx_fmt_ee (code, result_mode, x, y);
 
   create_output_operand (&ops[0], optimize ? NULL_RTX : target, result_mode);

Reply via email to