diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 6f5cbc541d8..8a119038ba1 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -799,11 +799,14 @@ because of offering further optimization opportunities. */ if (register_operand (operands[0], DImode)) { - rtx first, second; + rtx lowpart, highpart; - split_double (operands[1], &first, &second); - emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), first)); - emit_insn (gen_movsi (gen_highpart (SImode, operands[0]), second)); + if (TARGET_BIG_ENDIAN) + split_double (operands[1], &highpart, &lowpart); + else + split_double (operands[1], &lowpart, &highpart); + emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), lowpart)); + emit_insn (gen_movsi (gen_highpart (SImode, operands[0]), highpart)); DONE; }