summaryrefslogtreecommitdiff
path: root/test/tls/tls-macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/tls/tls-macros.h')
-rw-r--r--test/tls/tls-macros.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/tls/tls-macros.h b/test/tls/tls-macros.h
index 2787809f5..56347b45d 100644
--- a/test/tls/tls-macros.h
+++ b/test/tls/tls-macros.h
@@ -885,6 +885,43 @@ register void *__gp __asm__("$29");
: "=&r" (__result) : "r" (tp)); \
__result; })
+#elif defined __xtensa__
+
+#define TLS_GD(x) \
+ ({ int *__l; \
+ asm ("movi a8, " #x "@TLSFUNC\n\t" \
+ "movi a10, " #x "@TLSARG\n\t" \
+ "callx8.tls a8, " #x "@TLSCALL\n\t" \
+ "mov %0, a10\n\t" \
+ : "=r" (__l) \
+ : \
+ : "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); \
+ __l; })
+
+#define TLS_LD(x) \
+ ({ int *__l; \
+ asm ("movi a8, " #x "@TLSFUNC\n\t" \
+ "movi a10, " #x "@TLSARG\n\t" \
+ "callx8.tls a8, " #x "@TLSCALL\n\t" \
+ "movi %0, " #x "@TPOFF\n\t" \
+ "add %0, %0, a10\n\t" \
+ : "=r" (__l) \
+ : \
+ : "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); \
+ __l; })
+
+#define TLS_IE(x) TLS_LE(x)
+
+#define TLS_LE(x) \
+ ({ int *__l; \
+ int __t; \
+ asm ("rur %0, threadptr\n\t" \
+ "movi %1, " #x "@TPOFF\n\t" \
+ "add %0, %0, %1\n\t" \
+ : "=r" (__l), "=r" (__t) ); \
+ __l; }); \
+
+
#elif !defined TLS_LE || !defined TLS_IE \
|| !defined TLS_LD || !defined TLS_GD
# error "No support for this architecture so far."