aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-04-24 17:49:36 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-04-24 17:49:36 +0200
commit73f1289e49d2c1c6d23278dc7a1c70f80cd1e6b4 (patch)
tree533a4515fd04b33b51b59a7bb72a345adb016276 /gcc
parentfb8b3e2993f4f1bb646369feab59b3bd80d1d0e1 (diff)
downloadgcc-73f1289e49d2c1c6d23278dc7a1c70f80cd1e6b4.zip
gcc-73f1289e49d2c1c6d23278dc7a1c70f80cd1e6b4.tar.gz
gcc-73f1289e49d2c1c6d23278dc7a1c70f80cd1e6b4.tar.bz2
re PR target/90193 (asm goto with TLS "m" input operand generates incorrect assembler in O1 and O2)
PR target/90193 * rtl.c (classify_insn): Return JUMP_INSN for asm goto. * emit-rtl.c (try_split): Copy over REG_LABEL_TARGET. * gcc.target/i386/pr90193.c: New test. From-SVN: r270550
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/emit-rtl.c1
-rw-r--r--gcc/rtl.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90193.c21
5 files changed, 38 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6d09649..a8f5212 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-04-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/90193
+ * rtl.c (classify_insn): Return JUMP_INSN for asm goto.
+ * emit-rtl.c (try_split): Copy over REG_LABEL_TARGET.
+
2019-04-24 Andreas Krebbel <krebbel@linux.ibm.com>
PR target/89952
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 4b0aa7c..15dffa5 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3940,6 +3940,7 @@ try_split (rtx pat, rtx_insn *trial, int last)
break;
case REG_NON_LOCAL_GOTO:
+ case REG_LABEL_TARGET:
for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
{
if (JUMP_P (insn))
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 8a89777..d7b8e98 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -746,6 +746,8 @@ classify_insn (rtx x)
return CALL_INSN;
if (ANY_RETURN_P (x))
return JUMP_INSN;
+ if (GET_CODE (x) == ASM_OPERANDS && ASM_OPERANDS_LABEL_VEC (x))
+ return JUMP_INSN;
if (GET_CODE (x) == SET)
{
if (GET_CODE (SET_DEST (x)) == PC)
@@ -772,6 +774,9 @@ classify_insn (rtx x)
return CALL_INSN;
if (has_return_p)
return JUMP_INSN;
+ if (GET_CODE (XVECEXP (x, 0, 0)) == ASM_OPERANDS
+ && ASM_OPERANDS_LABEL_VEC (XVECEXP (x, 0, 0)))
+ return JUMP_INSN;
}
#ifdef GENERATOR_FILE
if (GET_CODE (x) == MATCH_OPERAND
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6a34f20..70ffb8d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-04-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/90193
+ * gcc.target/i386/pr90193.c: New test.
+
2019-04-24 Andreas Krebbel <krebbel@linux.ibm.com>
PR target/89952
diff --git a/gcc/testsuite/gcc.target/i386/pr90193.c b/gcc/testsuite/gcc.target/i386/pr90193.c
new file mode 100644
index 0000000..194cffe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90193.c
@@ -0,0 +1,21 @@
+/* PR target/90193 *
+/* { dg-do link } */
+/* { dg-options "-O1" } */
+/* { dg-require-effective-target tls } */
+
+__thread int var;
+
+static int
+foo (void)
+{
+ asm goto ("jmp %l[l]\n\t" : : "m" (var) : : l);
+ return 0;
+l:
+ return 1;
+}
+
+int
+main ()
+{
+ return foo ();
+}