From: Marcus Comstedt Date: Fri, 19 Mar 2021 19:49:09 +0000 (+0100) Subject: RISC-V: Fix riscv_subword() for big endian X-Git-Tag: basepoints/gcc-12~474 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fffefe3d9d1715f83c82331f2265e040f42d09fe;p=thirdparty%2Fgcc.git RISC-V: Fix riscv_subword() for big endian gcc/ * config/riscv/riscv.c (riscv_subword): Take endianness into account when calculating the byte offset. --- diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index fe48db7a2798..17cdf705c328 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)