Fix for PR/94542, do not make TLS refs PC-relative

For rs6000 target, it is not valid to make PC-relative
references to TLS symbols. So addr_to_insn_form() needs
to check if things are TLS before returning PC-rel forms.

2020-04-14  Aaron Sawdey  <acsawdey@linux.ibm.com>

	PR target/94542
	* config/rs6000/rs6000.c (address_to_insn_form): Do not attempt to
	use PC-relative addressing for TLS references.
This commit is contained in:
Aaron Sawdey 2020-04-14 14:38:47 -05:00
parent 52d4ed1d96
commit aba6453890
2 changed files with 28 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2020-04-14 Aaron Sawdey <acsawdey@linux.ibm.com>
PR target/94542
* config/rs6000/rs6000.c (address_to_insn_form): Do not attempt to
use PC-relative addressing for TLS references.
2020-04-14 Martin Jambor <mjambor@suse.cz>
PR ipa/94434

View File

@ -24824,15 +24824,21 @@ address_to_insn_form (rtx addr,
if (GET_RTX_CLASS (GET_CODE (addr)) == RTX_AUTOINC)
return INSN_FORM_UPDATE;
/* Handle PC-relative symbols and labels. Check for both local and external
symbols. Assume labels are always local. */
/* Handle PC-relative symbols and labels. Check for both local and
external symbols. Assume labels are always local. TLS symbols
are not PC-relative for rs6000. */
if (TARGET_PCREL)
{
if (SYMBOL_REF_P (addr) && !SYMBOL_REF_LOCAL_P (addr))
return INSN_FORM_PCREL_EXTERNAL;
if (SYMBOL_REF_P (addr) || LABEL_REF_P (addr))
if (LABEL_REF_P (addr))
return INSN_FORM_PCREL_LOCAL;
if (SYMBOL_REF_P (addr) && !SYMBOL_REF_TLS_MODEL (addr))
{
if (!SYMBOL_REF_LOCAL_P (addr))
return INSN_FORM_PCREL_EXTERNAL;
else
return INSN_FORM_PCREL_LOCAL;
}
}
if (GET_CODE (addr) == CONST)
@ -24866,14 +24872,19 @@ address_to_insn_form (rtx addr,
return INSN_FORM_BAD;
/* Check for local and external PC-relative addresses. Labels are always
local. */
local. TLS symbols are not PC-relative for rs6000. */
if (TARGET_PCREL)
{
if (SYMBOL_REF_P (op0) && !SYMBOL_REF_LOCAL_P (op0))
return INSN_FORM_PCREL_EXTERNAL;
if (SYMBOL_REF_P (op0) || LABEL_REF_P (op0))
if (LABEL_REF_P (op0))
return INSN_FORM_PCREL_LOCAL;
if (SYMBOL_REF_P (op0) && !SYMBOL_REF_TLS_MODEL (op0))
{
if (!SYMBOL_REF_LOCAL_P (op0))
return INSN_FORM_PCREL_EXTERNAL;
else
return INSN_FORM_PCREL_LOCAL;
}
}
/* If it isn't PC-relative, the address must use a base register. */