public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [AArch64][TLSGD Trad][2/2] Implement TLS General Dynamic support for Tiny memory model
@ 2015-06-19 15:23 Jiong Wang
  0 siblings, 0 replies; only message in thread
From: Jiong Wang @ 2015-06-19 15:23 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 449 bytes --]


As we have generalized TLS GD code for all memory model in patch 1,
support for tiny model is quite straightforward. We just need to output
different assembly according to memory model.

2015-06-19  Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/aarch64.md (tlsgd): Support tiny model constraint.

gcc/testsuite/
  * gcc.target/aarch64/tlsgd_small.c: New.
  * gcc.target/aarch64/tlsgd_tiny.c: Ditto.
-- 
Regards,
Jiong


[-- Attachment #2: tlsgdtrad2.patch --]
[-- Type: text/x-diff, Size: 2322 bytes --]

commit d82bdca987581dbca6946b0f09e19bae495e79a3
Author: Jiong Wang <jiong.wang@arm.com>
Date:   Mon May 18 17:17:38 2015 +0100

    support GD

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 4fe54c9..4adf0a6 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4263,9 +4263,19 @@
    (clobber (reg:DI LR_REGNUM))
   ]
   ""
-  "adrp\\tx0, %A1\;add\\tx0, x0, %L1\;bl\\t%2\;nop"
+  {
+    if (aarch64_cmodel_var == AARCH64_CMODEL_TINY)
+      return "adr\tx0, %A1;bl\t%2;nop";
+    else if (aarch64_cmodel_var == AARCH64_CMODEL_SMALL)
+      return "adrp\tx0, %A1;add\tx0, x0, %L1;bl\t%2;nop";
+    else
+      /* TBD: Large model to be supported.  */
+      gcc_unreachable ();
+  }
   [(set_attr "type" "call")
-   (set_attr "length" "16")])
+   (set (attr "length")
+	 (if_then_else (match_test "aarch64_cmodel_var == AARCH64_CMODEL_TINY")
+	 (const_int 12) (const_int 16)))])
 
 (define_insn "tlsie_small_<mode>"
   [(set (match_operand:PTR 0 "register_operand" "=r")
diff --git a/gcc/testsuite/gcc.target/aarch64/tlsgd_small.c b/gcc/testsuite/gcc.target/aarch64/tlsgd_small.c
new file mode 100644
index 0000000..b77b94d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/tlsgd_small.c
@@ -0,0 +1,9 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_native } */
+/* { dg-options "-O2 -ftls-model=global-dynamic -fPIC -mtls-dialect=trad --save-temps" } */
+
+#include "tls.c"
+
+/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, :tlsgd:" 2 } } */
+/* { dg-final { scan-assembler-times "bl\t__tls_get_addr" 2 } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/tlsgd_tiny.c b/gcc/testsuite/gcc.target/aarch64/tlsgd_tiny.c
new file mode 100644
index 0000000..26365ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/tlsgd_tiny.c
@@ -0,0 +1,9 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_native } */
+/* { dg-options "-O2 -ftls-model=global-dynamic -fPIC -mtls-dialect=trad -mcmodel=tiny --save-temps" } */
+
+#include "tls.c"
+
+/* { dg-final { scan-assembler-times "adr\tx\[0-9\]+, :tlsgd:" 2 } } */
+/* { dg-final { scan-assembler-times "bl\t__tls_get_addr" 2 } } */
+/* { dg-final { cleanup-saved-temps } } */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-19 14:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-19 15:23 [AArch64][TLSGD Trad][2/2] Implement TLS General Dynamic support for Tiny memory model Jiong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).