Richard Sandiford <richard.sandif...@arm.com> writes: > Evgeny Karpov <evgeny.kar...@microsoft.com> writes: >> + { >> + rtx const_int = imm; >> + const_int = XEXP (const_int, 0); >> + XEXP (const_int, 1) = GEN_INT(const_offset % (1 << 20)); > > CONST_INTs are shared objects, so we can't modify their value in-place.
Gah, sorry, I misread. The patch was only modifying the PLUS, which should be valid. My comment below still stands though. > It might be easier to pass base and const_offset from the caller > (aarch64_expand_mov_immediate). We are then guaranteed that the > offset is constant and don't need to worry about the SVE case. > The new SYM+OFF expression can be calculated using plus_constant. > > I think it'd be worth asserting that the offset fits in 32 bits, > since if by some bug the offset is larger, we'd generate silent > wrong code (in the sense that the compiler would truncate the offset > before the assembler sees it).