aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Comstedt <marcus@mc.pp.se>2021-03-19 20:49:09 +0100
committerKito Cheng <kito.cheng@sifive.com>2021-03-23 17:32:41 +0800
commitfffefe3d9d1715f83c82331f2265e040f42d09fe (patch)
tree75b0066c2185b65c29d1170b384d2dcb98a8cdcb
parent7ac4dfec3912ef0be85542a00628c3ba01ddea2a (diff)
downloadgcc-fffefe3d9d1715f83c82331f2265e040f42d09fe.zip
gcc-fffefe3d9d1715f83c82331f2265e040f42d09fe.tar.gz
gcc-fffefe3d9d1715f83c82331f2265e040f42d09fe.tar.bz2
RISC-V: Fix riscv_subword() for big endian
gcc/ * config/riscv/riscv.c (riscv_subword): Take endianness into account when calculating the byte offset.
-rw-r--r--gcc/config/riscv/riscv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index fe48db7..17cdf70 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -1966,7 +1966,7 @@ riscv_address_cost (rtx addr, machine_mode mode,
rtx
riscv_subword (rtx op, bool high_p)
{
- unsigned int byte = high_p ? UNITS_PER_WORD : 0;
+ unsigned int byte = (high_p != BYTES_BIG_ENDIAN) ? UNITS_PER_WORD : 0;
machine_mode mode = GET_MODE (op);
if (mode == VOIDmode)