Hi, This change addresses a comment from Richard Sandiford in: https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02165.html
where a previous fix was over eager in converting OP_OUT reloads to OP_INOUT. No testcase here either but I will try and exercise this code later with a targeted test using the RTL frontend if possible. Thanks, Matthew gcc/ PR target/78660 * lra-constraints.c (curr_insn_transform): Tighten condition for converting SUBREG reloads from OP_OUT to OP_INOUT. --- gcc/lra-constraints.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index f29308f..66ff2bb 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -4139,7 +4139,17 @@ curr_insn_transform (bool check_only_p) || (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (reg)) && WORD_REGISTER_OPERATIONS))) { - if (type == OP_OUT) + /* An OP_INOUT is required when reloading a subreg of a + mode wider than a word to ensure that data beyond the + word being reloaded is preserved. Also automatically + ensure that strict_low_part reloads are made into + OP_INOUT which should already be true from the backend + constraints. */ + if (type == OP_OUT + && (curr_static_id->operand[i].strict_low + || (GET_MODE_SIZE (GET_MODE (reg)) > UNITS_PER_WORD + && GET_MODE_SIZE (mode) + < GET_MODE_SIZE (GET_MODE (reg))))) type = OP_INOUT; loc = &SUBREG_REG (*loc); mode = GET_MODE (*loc); -- 2.2.1