aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2022-06-07 21:01:01 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2022-06-08 08:47:40 -0700
commite94c6dbfb57a862dd8a8685eabc4886ad1aaea25 (patch)
tree4dffcf96c2d0745767f8105f5ce0e68e42e1f0c0 /gcc
parent90a6c3b6d69765ea9269ba7ae16ef02d5527e875 (diff)
downloadgcc-e94c6dbfb57a862dd8a8685eabc4886ad1aaea25.zip
gcc-e94c6dbfb57a862dd8a8685eabc4886ad1aaea25.tar.gz
gcc-e94c6dbfb57a862dd8a8685eabc4886ad1aaea25.tar.bz2
gcc: xtensa: fix PR target/105879
split_double operates with the 'word that comes first in memory in the target' terminology, while gen_lowpart operates with the 'value representing some low-order bits of X' terminology. They are not equivalent and must be dealt with differently on little- and big-endian targets. gcc/ PR target/105879 * config/xtensa/xtensa.md (movdi): Rename 'first' and 'second' to 'lowpart' and 'highpart' so that they match 'gen_lowpart' and 'gen_highpart' bitwise semantics and fix order of highpart and lowpart depending on target endianness.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/xtensa/xtensa.md13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 6f5cbc5..8a11903 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;
-
- 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));
+ rtx lowpart, highpart;
+
+ 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;
}