@@ -1,3 +1,11 @@
+2011-02-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/47364
+ * builtins.c (expand_builtin_strlen): Properly handle target
+ not in Pmode.
+
+ * config/i386/i386.c (ix86_expand_strlen): Revet the last change.
+
2011-02-18 H.J. Lu <hongjiu.lu@intel.com>
PR target/47744
@@ -3408,9 +3408,9 @@ expand_builtin_strlen (tree exp, rtx target,
result = target;
if (! (result != 0
&& REG_P (result)
- && GET_MODE (result) == insn_mode
+ && GET_MODE (result) == Pmode
&& REGNO (result) >= FIRST_PSEUDO_REGISTER))
- result = gen_reg_rtx (insn_mode);
+ result = gen_reg_rtx (Pmode);
/* Make a place to hold the source address. We will not expand
the actual source until we are sure that the expansion will
@@ -21902,8 +21902,6 @@ ix86_expand_strlen (rtx out, rtx src, rtx eoschar, rtx align)
often used and I use one fewer register for the lifetime of
output_strlen_unroll() this is better. */
- if (GET_MODE (out) != Pmode)
- out = convert_to_mode (Pmode, out, 1);
emit_move_insn (out, addr);
ix86_expand_strlensi_unroll_1 (out, src, align);
@@ -21935,15 +21933,7 @@ ix86_expand_strlen (rtx out, rtx src, rtx eoschar, rtx align)
scratch4), UNSPEC_SCAS);
emit_insn (gen_strlenqi_1 (scratch1, scratch3, unspec));
emit_insn (ix86_gen_one_cmpl2 (scratch2, scratch1));
- if (GET_MODE (out) != Pmode)
- {
- rtx scratch5 = gen_reg_rtx (Pmode);
- emit_insn (ix86_gen_add3 (scratch5, scratch2, constm1_rtx));
- scratch5 = convert_to_mode (GET_MODE (out), scratch5, 1);
- emit_move_insn (out, scratch5);
- }
- else
- emit_insn (ix86_gen_add3 (out, scratch2, constm1_rtx));
+ emit_insn (ix86_gen_add3 (out, scratch2, constm1_rtx));
}
return true;
}
@@ -1,3 +1,8 @@
+2011-02-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/47364
+ * gcc.dg/torture/pr47364-1.c: New.
+
2011-02-18 H.J. Lu <hongjiu.lu@intel.com>
PR target/47744
new file mode 100644
@@ -0,0 +1,8 @@
+/* { dg-do run } */
+
+char one[50] = "ijk";
+int
+main (void)
+{
+ return __builtin_strlen (one) != 3;
+}