https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67675
Oleg Endo changed:
What|Removed |Added
Status|UNCONFIRMED |NEW
Last reconfirmed||2015-09-22
Ever confirmed|0 |1
--- Comment #1 from Oleg Endo ---
This fixes it:
Index: gcc/config/sh/sh-mem.cc
===
--- gcc/config/sh/sh-mem.cc (revision 227970)
+++ gcc/config/sh/sh-mem.cc (working copy)
@@ -224,11 +224,10 @@
rtx_code_label *L_loop_long = gen_label_rtx ();
rtx_code_label *L_end_loop_long = gen_label_rtx ();
- int align = INTVAL (operands[3]);
+ const unsigned int addr1_alignment = MEM_ALIGN (operands[1]) /
BITS_PER_UNIT;
+ const unsigned int addr2_alignment = MEM_ALIGN (operands[2]) /
BITS_PER_UNIT;
- emit_move_insn (tmp0, const0_rtx);
-
- if (align < 4)
+ if (addr1_alignment < 4 && addr2_alignment < 4)
{
emit_insn (gen_iorsi3 (tmp1, s1_addr, s2_addr));
emit_insn (gen_tstsi_t (tmp1, GEN_INT (3)));
@@ -235,6 +234,18 @@
jump = emit_jump_insn (gen_branch_false (L_loop_byte));
add_int_reg_note (jump, REG_BR_PROB, prob_likely);
}
+ else if (addr1_alignment < 4 && addr2_alignment >= 4)
+{
+ emit_insn (gen_tstsi_t (s1_addr, GEN_INT (3)));
+ jump = emit_jump_insn (gen_branch_false (L_loop_byte));
+ add_int_reg_note (jump, REG_BR_PROB, prob_likely);
+}
+ else if (addr1_alignment >= 4 && addr2_alignment < 4)
+{
+ emit_insn (gen_tstsi_t (s2_addr, GEN_INT (3)));
+ jump = emit_jump_insn (gen_branch_false (L_loop_byte));
+ add_int_reg_note (jump, REG_BR_PROB, prob_likely);
+}
addr1 = adjust_automodify_address (addr1, SImode, s1_addr, 0);
addr2 = adjust_automodify_address (addr2, SImode, s2_addr, 0);