RISC-V: Fix riscv_subword() for big endian

gcc/
	* config/riscv/riscv.c (riscv_subword): Take endianness into
	account when calculating the byte offset.
This commit is contained in:
Marcus Comstedt 2021-03-19 20:49:09 +01:00 committed by Kito Cheng
parent 7ac4dfec39
commit fffefe3d9d

View file

@ -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)