Hi,

GET_MODE returns VOIDmode on CONST_INT.  It happens with -O0.  This
patch uses counter_mode on count_exp to get mode.  Tested on
Linux/x86-64 without regressions.  OK for trunk and 4.9 branch?

Thanks.


H.J.
---
gcc/

2014-04-17  H.J. Lu  <hongjiu...@intel.com>

        PR target/60868
        * config/i386/i386.c (ix86_expand_set_or_movmem): Call counter_mode 
        on count_exp to get mode.

gcc/testsuite/

2014-04-17  H.J. Lu  <hongjiu...@intel.com>

        PR target/60868
        * gcc.target/i386/pr60868.c: New testcase.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 536f50f..7a68623 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -24392,7 +24392,8 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx 
count_exp, rtx val_exp,
          if (jump_around_label == NULL_RTX)
            jump_around_label = gen_label_rtx ();
          emit_cmp_and_jump_insns (count_exp, GEN_INT (dynamic_check - 1),
-                                  LEU, 0, GET_MODE (count_exp), 1, hot_label);
+                                  LEU, 0, counter_mode (count_exp),
+                                  1, hot_label);
          predict_jump (REG_BR_PROB_BASE * 90 / 100);
          if (issetmem)
            set_storage_via_libcall (dst, count_exp, val_exp, false);
diff --git a/gcc/testsuite/gcc.target/i386/pr60868.c 
b/gcc/testsuite/gcc.target/i386/pr60868.c
new file mode 100644
index 0000000..c30bbfc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr60868.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -minline-all-stringops -minline-stringops-dynamically 
-march=core2" } */
+
+void bar (float *);
+
+void foo (void)
+{
+  float b[256] = {0};
+  bar(b);
+}

Reply via email to