diff mbox series

[committed] alpha: Fix duplicate !tlsgd!62 assemble error [PR115526]

Message ID CAFULd4ZXm8KrR5b2FzYBpHeeg=zz_Mcp9JHWqm+cf0Q8y+Mqvw@mail.gmail.com
State New
Headers show
Series [committed] alpha: Fix duplicate !tlsgd!62 assemble error [PR115526] | expand

Commit Message

Uros Bizjak July 17, 2024, 4:16 p.m. UTC
Add missing "cannot_copy" attribute to instructions that have to
stay in 1-1 correspondence with another insn.

    PR target/115526

gcc/ChangeLog:

    * config/alpha/alpha.md (movdi_er_high_g): Add cannot_copy attribute.
    (movdi_er_tlsgd): Ditto.
    (movdi_er_tlsldm): Ditto.
    (call_value_osf_<tls>): Ditto.

gcc/testsuite/ChangeLog:

    * gcc.target/alpha/pr115526.c: New test.

Tested by Maciej on Alpha/Linux target and reported in the PR.

Uros.
diff mbox series

Patch

diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index 1e2de5a4d15..bd92392878e 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -3902,7 +3902,8 @@  (define_insn "movdi_er_high_g"
   else
     return "ldq %0,%2(%1)\t\t!literal!%3";
 }
-  [(set_attr "type" "ldsym")])
+  [(set_attr "type" "ldsym")
+   (set_attr "cannot_copy" "true")])
 
 (define_split
   [(set (match_operand:DI 0 "register_operand")
@@ -3926,7 +3927,8 @@  (define_insn "movdi_er_tlsgd"
     return "lda %0,%2(%1)\t\t!tlsgd";
   else
     return "lda %0,%2(%1)\t\t!tlsgd!%3";
-})
+}
+  [(set_attr "cannot_copy" "true")])
 
 (define_insn "movdi_er_tlsldm"
   [(set (match_operand:DI 0 "register_operand" "=r")
@@ -3939,7 +3941,8 @@  (define_insn "movdi_er_tlsldm"
     return "lda %0,%&(%1)\t\t!tlsldm";
   else
     return "lda %0,%&(%1)\t\t!tlsldm!%2";
-})
+}
+  [(set_attr "cannot_copy" "true")])
 
 (define_insn "*movdi_er_gotdtp"
   [(set (match_operand:DI 0 "register_operand" "=r")
@@ -5908,6 +5911,7 @@  (define_insn "call_value_osf_<tls>"
   "HAVE_AS_TLS"
   "ldq $27,%1($29)\t\t!literal!%2\;jsr $26,($27),%1\t\t!lituse_<tls>!%2\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
   [(set_attr "type" "jsr")
+   (set_attr "cannot_copy" "true")
    (set_attr "length" "16")])
 
 ;; We must use peep2 instead of a split because we need accurate life
diff --git a/gcc/testsuite/gcc.target/alpha/pr115526.c b/gcc/testsuite/gcc.target/alpha/pr115526.c
new file mode 100644
index 00000000000..2f57903fec3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/alpha/pr115526.c
@@ -0,0 +1,46 @@ 
+/* PR target/115526 */
+/* { dg-do assemble } */
+/* { dg-options "-O2 -Wno-attributes -fvisibility=hidden -fPIC -mcpu=ev4" } */
+
+struct _ts {
+  struct _dtoa_state *interp;
+};
+struct Bigint {
+  int k;
+} *_Py_dg_strtod_bs;
+struct _dtoa_state {
+  struct Bigint p5s;
+  struct Bigint *freelist[];
+};
+extern _Thread_local struct _ts _Py_tss_tstate;
+typedef struct Bigint Bigint;
+int pow5mult_k;
+long _Py_dg_strtod_ndigits;
+void PyMem_Free();
+void Bfree(Bigint *v) {
+  if (v)
+    {
+      if (v->k)
+	PyMem_Free();
+      else {
+	struct _dtoa_state *interp = _Py_tss_tstate.interp;
+	interp->freelist[v->k] = v;
+      }
+    }
+}
+static Bigint *pow5mult(Bigint *b) {
+  for (;;) {
+    if (pow5mult_k & 1) {
+      Bfree(b);
+      if (b == 0)
+        return 0;
+    }
+    if (!(pow5mult_k >>= 1))
+      break;
+  }
+  return 0;
+}
+void _Py_dg_strtod() {
+  if (_Py_dg_strtod_ndigits)
+    pow5mult(_Py_dg_strtod_bs);
+}