[libc-commits] [PATCH] D143261: [libc][AArch64] Fix fullbuild when using G++/GCC
David Spickett via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Feb 20 00:40:14 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG78cd158cf92c: [libc][AArch64] Fix fullbuild when using G++/GCC (authored by DavidSpickett).
Changed prior to commit:
https://reviews.llvm.org/D143261?vs=494584&id=498749#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143261/new/
https://reviews.llvm.org/D143261
Files:
libc/src/__support/FPUtil/aarch64/FEnvImpl.h
libc/src/__support/threads/linux/thread.cpp
Index: libc/src/__support/threads/linux/thread.cpp
===================================================================
--- libc/src/__support/threads/linux/thread.cpp
+++ libc/src/__support/threads/linux/thread.cpp
@@ -214,7 +214,12 @@
#ifdef LIBC_TARGET_ARCH_IS_AARCH64
// We set the frame pointer to be the same as the "sp" so that start args
// can be sniffed out from start_thread.
+#ifdef __clang__
+ // GCC does not currently implement __arm_wsr64/__arm_rsr64.
__arm_wsr64("x29", __arm_rsr64("sp"));
+#else
+ asm volatile("mov x29, sp");
+#endif
#endif
start_thread();
} else if (clone_result < 0) {
Index: libc/src/__support/FPUtil/aarch64/FEnvImpl.h
===================================================================
--- libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -67,13 +67,39 @@
(status & INEXACT ? FE_INEXACT : 0);
}
- static uint32_t getControlWord() { return __arm_rsr("fpcr"); }
+ static uint32_t getControlWord() {
+#ifdef __clang__
+ // GCC does not currently support __arm_rsr.
+ return __arm_rsr("fpcr");
+#else
+ return __builtin_aarch64_get_fpcr();
+#endif
+ }
- static void writeControlWord(uint32_t fpcr) { __arm_wsr("fpcr", fpcr); }
+ static void writeControlWord(uint32_t fpcr) {
+#ifdef __clang__
+ // GCC does not currently support __arm_wsr.
+ __arm_wsr("fpcr", fpcr);
+#else
+ __builtin_aarch64_set_fpcr(fpcr);
+#endif
+ }
- static uint32_t getStatusWord() { return __arm_rsr("fpsr"); }
+ static uint32_t getStatusWord() {
+#ifdef __clang__
+ return __arm_rsr("fpsr");
+#else
+ return __builtin_aarch64_get_fpsr();
+#endif
+ }
- static void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); }
+ static void writeStatusWord(uint32_t fpsr) {
+#ifdef __clang__
+ __arm_wsr("fpsr", fpsr);
+#else
+ __builtin_aarch64_set_fpsr(fpsr);
+#endif
+ }
};
LIBC_INLINE int enable_except(int excepts) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143261.498749.patch
Type: text/x-patch
Size: 1979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230220/7f8a7ea1/attachment.bin>
More information about the libc-commits
mailing list