@@ -84,6 +84,7 @@ extern int emit_move_sequence (rtx *, machine_mode, rtx);
extern bool m68k_movem_pattern_p (rtx, rtx, HOST_WIDE_INT, bool);
extern const char *m68k_output_movem (rtx *, rtx, HOST_WIDE_INT, bool);
extern bool m68k_epilogue_uses (int);
+extern void m68k_final_prescan_insn (rtx_insn *, rtx *, int);
/* Functions from m68k.cc used in constraints.md. */
extern rtx m68k_unwrap_symbol (rtx, bool);
@@ -2550,6 +2550,18 @@ m68k_adjust_decorated_operand (rtx op)
}
}
+/* Prescan insn before outputing assembler for it. */
+
+void
+m68k_final_prescan_insn (rtx_insn *insn ATTRIBUTE_UNUSED,
+ rtx *operands, int n_operands)
+{
+ int i;
+
+ for (i = 0; i < n_operands; ++i)
+ m68k_adjust_decorated_operand (operands[i]);
+}
+
/* Move X to a register and add REG_EQUAL note pointing to ORIG.
If REG is non-null, use it; generate new pseudo otherwise. */
@@ -3658,6 +3670,7 @@ handle_move_double (rtx operands[2],
/* Normal case: do the two words, low-numbered first. */
+ m68k_final_prescan_insn (NULL, operands, 2);
handle_movsi (operands);
/* Do the middle one of the three words for long double */
@@ -3668,6 +3681,7 @@ handle_move_double (rtx operands[2],
if (addreg1)
handle_reg_adjust (addreg1, 4);
+ m68k_final_prescan_insn (NULL, middlehalf, 2);
handle_movsi (middlehalf);
}
@@ -3678,6 +3692,7 @@ handle_move_double (rtx operands[2],
handle_reg_adjust (addreg1, 4);
/* Do that word. */
+ m68k_final_prescan_insn (NULL, latehalf, 2);
handle_movsi (latehalf);
/* Undo the adds we just did. */
@@ -837,6 +837,9 @@ __transfer_from_trampoline () \
assemble_name ((FILE), (NAME)), \
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:
'.' for dot needed in Motorola-style opcode names.
'-' for an operand pushing on the stack:
similarity index 52%
copy from gcc/testsuite/gcc.target/m68k/tls-ld.c
copy to gcc/testsuite/gcc.target/m68k/tls-gd-off.c
@@ -1,14 +1,13 @@
/* { dg-do compile } */
/* { dg-skip-if "" { ! *-linux-* } } */
/* { dg-options "-O2 -fpic" } */
-/* { dg-final { scan-assembler "foo@TLSLDM\\(\%a5\\)" } } */
+/* { dg-final { scan-assembler "foo@TLSGD\\(\%a5\\)" } } */
/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */
-/* { dg-final { scan-assembler "lea \\(foo@TLSLDO,\%a0\\)" } } */
-static int __thread foo;
+extern int __thread foo[2];
int *
bar (void)
{
- return &foo;
+ return foo + 1;
}
similarity index 62%
copy from gcc/testsuite/gcc.target/m68k/tls-le.c
copy to gcc/testsuite/gcc.target/m68k/tls-ie-off.c
@@ -2,12 +2,12 @@
/* { dg-skip-if "" { ! *-linux-* } } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */
-/* { dg-final { scan-assembler "lea \\(foo@TLSLE,\%a0\\)" } } */
+/* { dg-final { scan-assembler "foo@TLSIE\\(\%a5\\)" } } */
-static int __thread foo;
+extern int __thread foo[2];
int *
bar (void)
{
- return &foo;
+ return foo + 1;
}
similarity index 52%
copy from gcc/testsuite/gcc.target/m68k/tls-ld.c
copy to gcc/testsuite/gcc.target/m68k/tls-ld-off.c
@@ -1,14 +1,14 @@
/* { dg-do compile } */
/* { dg-skip-if "" { ! *-linux-* } } */
/* { dg-options "-O2 -fpic" } */
-/* { dg-final { scan-assembler "foo@TLSLDM\\(\%a5\\)" } } */
+/* { dg-final { scan-assembler "foo@TLSLDM\\(%a5\\)" } } */
/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */
-/* { dg-final { scan-assembler "lea \\(foo@TLSLDO,\%a0\\)" } } */
+/* { dg-final { scan-assembler "foo\\+4@TLSLDO,%a0" } } */
-static int __thread foo;
+static int __thread foo[2];
int *
bar (void)
{
- return &foo;
+ return foo + 1;
}
similarity index 57%
copy from gcc/testsuite/gcc.target/m68k/tls-ld.c
copy to gcc/testsuite/gcc.target/m68k/tls-ld-xtls-off.c
@@ -1,14 +1,14 @@
/* { dg-do compile } */
/* { dg-skip-if "" { ! *-linux-* } } */
-/* { dg-options "-O2 -fpic" } */
+/* { dg-options "-O2 -fpic -mxtls" } */
/* { dg-final { scan-assembler "foo@TLSLDM\\(\%a5\\)" } } */
/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */
-/* { dg-final { scan-assembler "lea \\(foo@TLSLDO,\%a0\\)" } } */
+/* { dg-final { scan-assembler "#foo\\+4@TLSLDO,\%\[ad\]\[0-7\]" } } */
-static int __thread foo;
+static int __thread foo[2];
int *
bar (void)
{
- return &foo;
+ return foo + 1;
}
@@ -1,9 +1,9 @@
/* { dg-do compile } */
/* { dg-skip-if "" { ! *-linux-* } } */
/* { dg-options "-O2 -fpic" } */
-/* { dg-final { scan-assembler "foo@TLSLDM\\(\%a5\\)" } } */
+/* { dg-final { scan-assembler "foo@TLSLDM\\(%a5\\)" } } */
/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */
-/* { dg-final { scan-assembler "lea \\(foo@TLSLDO,\%a0\\)" } } */
+/* { dg-final { scan-assembler "foo@TLSLDO,%a0" } } */
static int __thread foo;
similarity index 62%
copy from gcc/testsuite/gcc.target/m68k/tls-le.c
copy to gcc/testsuite/gcc.target/m68k/tls-le-off.c
@@ -2,12 +2,12 @@
/* { dg-skip-if "" { ! *-linux-* } } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */
-/* { dg-final { scan-assembler "lea \\(foo@TLSLE,\%a0\\)" } } */
+/* { dg-final { scan-assembler "foo\\+4@TLSLE,%a0" } } */
-static int __thread foo;
+static int __thread foo[2];
int *
bar (void)
{
- return &foo;
+ return foo + 1;
}
new file mode 100644
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { ! *-linux-* } } */
+/* { dg-options "-O2 -mxtls" } */
+/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */
+/* { dg-final { scan-assembler "#foo\\+4@TLSLE,\%\[ad\]\[0-7\]" } } */
+
+static int __thread foo[2];
+
+int *
+bar (void)
+{
+ return foo + 1;
+}
@@ -2,7 +2,7 @@
/* { dg-skip-if "" { ! *-linux-* } } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */
-/* { dg-final { scan-assembler "lea \\(foo@TLSLE,\%a0\\)" } } */
+/* { dg-final { scan-assembler "foo@TLSLE,%a0" } } */
static int __thread foo;