+2012-09-03 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config/s390/s390.c (s390_loadrelative_operand_p): New function.
+ (s390_check_qrst_address, print_operand_address): Use
+ s390_loadrelative_operand_p instead of s390_symref_operand_p.
+ (s390_check_symref_alignment): Accept pointer size alignment for GOT slots.
+ (legitimize_pic_address): Use load relative on z10 or later.
+
2012-09-03 Jakub Jelinek <jakub@redhat.com>
PR debug/53923
return true;
}
+/* Return TRUE if ADDR is an operand valid for a load/store relative
+ instructions. Be aware that the alignment of the operand needs to
+ be checked separately. */
+static bool
+s390_loadrelative_operand_p (rtx addr)
+{
+ if (GET_CODE (addr) == CONST)
+ addr = XEXP (addr, 0);
+
+ /* Enable load relative for symbol@GOTENT. */
+ if (GET_CODE (addr) == UNSPEC
+ && XINT (addr, 1) == UNSPEC_GOTENT)
+ return true;
+
+ return s390_symref_operand_p (addr, NULL, NULL);
+}
/* Return true if the address in OP is valid for constraint letter C
if wrapped in a MEM rtx. Set LIT_POOL_OK to true if it literal
/* This check makes sure that no symbolic address (except literal
pool references) are accepted by the R or T constraints. */
- if (s390_symref_operand_p (op, NULL, NULL))
+ if (s390_loadrelative_operand_p (op))
return 0;
/* Ensure literal pool references are only accepted if LIT_POOL_OK. */
HOST_WIDE_INT addend;
rtx symref;
+ /* Accept symbol@GOTENT with pointer size alignment. */
+ if (GET_CODE (addr) == CONST
+ && GET_CODE (XEXP (addr, 0)) == UNSPEC
+ && XINT (XEXP (addr, 0), 1) == UNSPEC_GOTENT
+ && alignment <= UNITS_PER_LONG)
+ return true;
+
if (!s390_symref_operand_p (addr, &symref, &addend))
return false;
new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTENT);
new_rtx = gen_rtx_CONST (Pmode, new_rtx);
- emit_move_insn (temp, new_rtx);
- new_rtx = gen_const_mem (Pmode, temp);
+ if (!TARGET_Z10)
+ {
+ emit_move_insn (temp, new_rtx);
+ new_rtx = gen_const_mem (Pmode, temp);
+ }
+ else
+ new_rtx = gen_const_mem (GET_MODE (reg), new_rtx);
emit_move_insn (reg, new_rtx);
new_rtx = reg;
}
{
struct s390_address ad;
- if (s390_symref_operand_p (addr, NULL, NULL))
+ if (s390_loadrelative_operand_p (addr))
{
if (!TARGET_Z10)
{