+2014-01-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/59003
+ * config/i386/i386.c (expand_small_movmem_or_setmem): If mode is
+ smaller than size, perform several stores or loads and stores
+ at dst + count - size to store or copy all of size bytes, rather
+ than just last modesize bytes.
+
2014-01-20 DJ Delorie <dj@redhat.com>
* config/rl78/rl78.c (rl78_propogate_register_origins): Verify
}
destmem = offset_address (destmem, count, 1);
- destmem = offset_address (destmem, GEN_INT (-size - GET_MODE_SIZE (mode)),
+ destmem = offset_address (destmem, GEN_INT (-2 * size),
GET_MODE_SIZE (mode));
- if (issetmem)
- emit_move_insn (destmem, gen_lowpart (mode, value));
- else
+ if (!issetmem)
{
srcmem = offset_address (srcmem, count, 1);
- srcmem = offset_address (srcmem, GEN_INT (-size - GET_MODE_SIZE (mode)),
+ srcmem = offset_address (srcmem, GEN_INT (-2 * size),
GET_MODE_SIZE (mode));
- emit_move_insn (destmem, srcmem);
+ }
+ for (n = 0; n * GET_MODE_SIZE (mode) < size; n++)
+ {
+ if (issetmem)
+ emit_move_insn (destmem, gen_lowpart (mode, value));
+ else
+ {
+ emit_move_insn (destmem, srcmem);
+ srcmem = offset_address (srcmem, modesize, GET_MODE_SIZE (mode));
+ }
+ destmem = offset_address (destmem, modesize, GET_MODE_SIZE (mode));
}
emit_jump_insn (gen_jump (done_label));
emit_barrier ();
2014-01-21 Jakub Jelinek <jakub@redhat.com>
+ PR target/59003
+ * gcc.dg/tree-prof/pr59003.c: New test.
+
PR middle-end/59860
* gcc.dg/strlenopt-4.c: Expect the same counts on s390*-* as on all
other targets.
--- /dev/null
+/* PR target/59003 */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mtune=amdfam10" { target i?86-*-* x86_64-*-* } } */
+
+__attribute__((noinline, noclone)) void *
+foo (void *p, unsigned int q)
+{
+ return __builtin_memset (p, 0, q * 4UL);
+}
+
+char buf[128] __attribute__((aligned (32)));
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 100000; i++)
+ foo (buf + 4, 1 + (i & 1));
+ for (i = 0; i < 128; i++)
+ {
+ buf[i] = 'X';
+ asm volatile ("" : : : "memory");
+ }
+ foo (buf + 32, 7);
+ for (i = 0; i < 128; i++)
+ if (buf[i] != ((i < 32 || i >= 32 + 28) ? 'X' : 0))
+ __builtin_abort ();
+ return 0;
+}