https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65342
--- Comment #29 from Iain Sandoe <iains at gcc dot gnu.org> --- Author: iains Date: Thu Oct 17 19:46:52 2019 New Revision: 277130 URL: https://gcc.gnu.org/viewcvs?rev=277130&root=gcc&view=rev Log: [Darwin, PPC] Fix PR 65342. The current Darwin load/store lo_sum patterns have neither predicate nor constraint. This means that most parts of the backend, which rely on recog() to validate the rtx, can produce invalid combinations/selections. For 32bit cases this isn't a problem since we can load/store to unaligned addresses using D-mode insns. Conversely, for 64bit instructions that use DS mode, this can manifest as assemble errors (for an assembler that checks the LO14 relocations), or as crashes caused by wrong offsets (or worse, wrong content for the two LSBs). What we want to check for "Y" on Darwin is: - that the alignment of the Symbols' target is sufficient for DS mode - that the offset is suitable for DS mode. (while looking through the Mach-O PIC unspecs). So, the patch removes the Darwin-specific lo_sum patterns (we begin using the movdi_internal64 patterns). We also we need to extend the handling of the mem_operand_gpr constraint to allow looking through Mach-O PIC UNSPECs in the lo_sum cases. gcc/ChangeLog: 2019-10-17 Iain Sandoe <i...@sandoe.co.uk> PR target/65342 * config/rs6000/darwin.md (movdi_low, movsi_low_st): Delete. (movdi_low_st): Delete. * config/rs6000/rs6000.c (darwin_rs6000_legitimate_lo_sum_const_p): New. (mem_operand_gpr): Validate Mach-O LO_SUM cases separately. * config/rs6000/rs6000.md (movsi_low): Delete. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/darwin.md trunk/gcc/config/rs6000/rs6000.c trunk/gcc/config/rs6000/rs6000.md