m68k: handle more cases of TLS symbols with offset
PR target/46179 * config/m68k/m68k.h (FINAL_PRESCAN_INSN): Don't define. * config/m68k/m68k.c (handle_move_double): Don't call m68k_final_prescan_insn. (m68k_adjust_decorated_operand): Renamed from m68k_final_prescan_insn, remove first and third operand and simplify. (print_operand): Call it. (print_operand_address): Call it. PR target/46179 * gcc.target/m68k/tls-dimode.c: New file. From-SVN: r263432
This commit is contained in:
parent
f10a91352f
commit
ede9446c26
|
@ -1,3 +1,15 @@
|
||||||
|
2018-08-08 Andreas Schwab <schwab@linux-m68k.org>
|
||||||
|
|
||||||
|
PR target/46179
|
||||||
|
* config/m68k/m68k.h (FINAL_PRESCAN_INSN): Don't define.
|
||||||
|
* config/m68k/m68k.c (handle_move_double): Don't call
|
||||||
|
m68k_final_prescan_insn.
|
||||||
|
(m68k_adjust_decorated_operand): Renamed from
|
||||||
|
m68k_final_prescan_insn, remove first and third operand and
|
||||||
|
simplify.
|
||||||
|
(print_operand): Call it.
|
||||||
|
(print_operand_address): Call it.
|
||||||
|
|
||||||
2018-08-08 Nathan Sidwell <nathan@acm.org>
|
2018-08-08 Nathan Sidwell <nathan@acm.org>
|
||||||
|
|
||||||
* diagnostic.c (diagnostic_report_current_module): Use
|
* diagnostic.c (diagnostic_report_current_module): Use
|
||||||
|
|
|
@ -2329,11 +2329,10 @@ m68k_unwrap_symbol (rtx orig, bool unwrap_reloc32_p)
|
||||||
return m68k_unwrap_symbol_1 (orig, unwrap_reloc32_p, NULL);
|
return m68k_unwrap_symbol_1 (orig, unwrap_reloc32_p, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prescan insn before outputing assembler for it. */
|
/* Adjust decorated address operand before outputing assembler for it. */
|
||||||
|
|
||||||
void
|
static void
|
||||||
m68k_final_prescan_insn (rtx_insn *insn ATTRIBUTE_UNUSED,
|
m68k_adjust_decorated_operand (rtx op)
|
||||||
rtx *operands, int n_operands)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -2355,45 +2354,38 @@ m68k_final_prescan_insn (rtx_insn *insn ATTRIBUTE_UNUSED,
|
||||||
to patch up anything outside of the operand. */
|
to patch up anything outside of the operand. */
|
||||||
|
|
||||||
subrtx_var_iterator::array_type array;
|
subrtx_var_iterator::array_type array;
|
||||||
for (i = 0; i < n_operands; ++i)
|
FOR_EACH_SUBRTX_VAR (iter, array, op, ALL)
|
||||||
{
|
{
|
||||||
rtx op;
|
rtx x = *iter;
|
||||||
|
if (m68k_unwrap_symbol (x, true) != x)
|
||||||
op = operands[i];
|
|
||||||
|
|
||||||
FOR_EACH_SUBRTX_VAR (iter, array, op, ALL)
|
|
||||||
{
|
{
|
||||||
rtx x = *iter;
|
rtx plus;
|
||||||
if (m68k_unwrap_symbol (x, true) != x)
|
|
||||||
|
gcc_assert (GET_CODE (x) == CONST);
|
||||||
|
plus = XEXP (x, 0);
|
||||||
|
|
||||||
|
if (GET_CODE (plus) == PLUS || GET_CODE (plus) == MINUS)
|
||||||
{
|
{
|
||||||
rtx plus;
|
rtx unspec;
|
||||||
|
rtx addend;
|
||||||
|
|
||||||
gcc_assert (GET_CODE (x) == CONST);
|
unspec = XEXP (plus, 0);
|
||||||
plus = XEXP (x, 0);
|
gcc_assert (GET_CODE (unspec) == UNSPEC);
|
||||||
|
addend = XEXP (plus, 1);
|
||||||
|
gcc_assert (CONST_INT_P (addend));
|
||||||
|
|
||||||
if (GET_CODE (plus) == PLUS || GET_CODE (plus) == MINUS)
|
/* We now have all the pieces, rearrange them. */
|
||||||
{
|
|
||||||
rtx unspec;
|
|
||||||
rtx addend;
|
|
||||||
|
|
||||||
unspec = XEXP (plus, 0);
|
/* Move symbol to plus. */
|
||||||
gcc_assert (GET_CODE (unspec) == UNSPEC);
|
XEXP (plus, 0) = XVECEXP (unspec, 0, 0);
|
||||||
addend = XEXP (plus, 1);
|
|
||||||
gcc_assert (CONST_INT_P (addend));
|
|
||||||
|
|
||||||
/* We now have all the pieces, rearrange them. */
|
/* Move plus inside unspec. */
|
||||||
|
XVECEXP (unspec, 0, 0) = plus;
|
||||||
|
|
||||||
/* Move symbol to plus. */
|
/* Move unspec to top level of const. */
|
||||||
XEXP (plus, 0) = XVECEXP (unspec, 0, 0);
|
XEXP (x, 0) = unspec;
|
||||||
|
|
||||||
/* Move plus inside unspec. */
|
|
||||||
XVECEXP (unspec, 0, 0) = plus;
|
|
||||||
|
|
||||||
/* Move unspec to top level of const. */
|
|
||||||
XEXP (x, 0) = unspec;
|
|
||||||
}
|
|
||||||
iter.skip_subrtxes ();
|
|
||||||
}
|
}
|
||||||
|
iter.skip_subrtxes ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3496,7 +3488,6 @@ handle_move_double (rtx operands[2],
|
||||||
|
|
||||||
/* Normal case: do the two words, low-numbered first. */
|
/* Normal case: do the two words, low-numbered first. */
|
||||||
|
|
||||||
m68k_final_prescan_insn (NULL, operands, 2);
|
|
||||||
handle_movsi (operands);
|
handle_movsi (operands);
|
||||||
|
|
||||||
/* Do the middle one of the three words for long double */
|
/* Do the middle one of the three words for long double */
|
||||||
|
@ -3507,7 +3498,6 @@ handle_move_double (rtx operands[2],
|
||||||
if (addreg1)
|
if (addreg1)
|
||||||
handle_reg_adjust (addreg1, 4);
|
handle_reg_adjust (addreg1, 4);
|
||||||
|
|
||||||
m68k_final_prescan_insn (NULL, middlehalf, 2);
|
|
||||||
handle_movsi (middlehalf);
|
handle_movsi (middlehalf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3518,7 +3508,6 @@ handle_move_double (rtx operands[2],
|
||||||
handle_reg_adjust (addreg1, 4);
|
handle_reg_adjust (addreg1, 4);
|
||||||
|
|
||||||
/* Do that word. */
|
/* Do that word. */
|
||||||
m68k_final_prescan_insn (NULL, latehalf, 2);
|
|
||||||
handle_movsi (latehalf);
|
handle_movsi (latehalf);
|
||||||
|
|
||||||
/* Undo the adds we just did. */
|
/* Undo the adds we just did. */
|
||||||
|
@ -4464,6 +4453,9 @@ floating_exact_log2 (rtx x)
|
||||||
void
|
void
|
||||||
print_operand (FILE *file, rtx op, int letter)
|
print_operand (FILE *file, rtx op, int letter)
|
||||||
{
|
{
|
||||||
|
if (op != NULL_RTX)
|
||||||
|
m68k_adjust_decorated_operand (op);
|
||||||
|
|
||||||
if (letter == '.')
|
if (letter == '.')
|
||||||
{
|
{
|
||||||
if (MOTOROLA)
|
if (MOTOROLA)
|
||||||
|
@ -4712,6 +4704,8 @@ print_operand_address (FILE *file, rtx addr)
|
||||||
{
|
{
|
||||||
struct m68k_address address;
|
struct m68k_address address;
|
||||||
|
|
||||||
|
m68k_adjust_decorated_operand (addr);
|
||||||
|
|
||||||
if (!m68k_decompose_address (QImode, addr, true, &address))
|
if (!m68k_decompose_address (QImode, addr, true, &address))
|
||||||
gcc_unreachable ();
|
gcc_unreachable ();
|
||||||
|
|
||||||
|
|
|
@ -867,9 +867,6 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
|
||||||
assemble_name ((FILE), (NAME)), \
|
assemble_name ((FILE), (NAME)), \
|
||||||
fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
|
fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
|
||||||
|
|
||||||
#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
|
|
||||||
m68k_final_prescan_insn (INSN, OPVEC, NOPERANDS)
|
|
||||||
|
|
||||||
/* On the 68000, we use several CODE characters:
|
/* On the 68000, we use several CODE characters:
|
||||||
'.' for dot needed in Motorola-style opcode names.
|
'.' for dot needed in Motorola-style opcode names.
|
||||||
'-' for an operand pushing on the stack:
|
'-' for an operand pushing on the stack:
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2018-08-08 Andreas Schwab <schwab@linux-m68k.org>
|
||||||
|
|
||||||
|
PR target/46179
|
||||||
|
* gcc.target/m68k/tls-dimode.c: New file.
|
||||||
|
|
||||||
2018-08-08 Nathan Sidwell <nathan@acm.org>
|
2018-08-08 Nathan Sidwell <nathan@acm.org>
|
||||||
|
|
||||||
* c-c++-common/inc-from-1a.h, c-c++-common/inc-from-1b.h,
|
* c-c++-common/inc-from-1a.h, c-c++-common/inc-from-1b.h,
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-skip-if "" { ! *-linux-* } } */
|
||||||
|
/* { dg-options "-w -O2" } */
|
||||||
|
|
||||||
|
__thread long long ti;
|
||||||
|
|
||||||
|
void f (void)
|
||||||
|
{
|
||||||
|
ti++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void g (long long x)
|
||||||
|
{
|
||||||
|
ti = x;
|
||||||
|
}
|
Loading…
Reference in New Issue