[libc-commits] [PATCH] D118099: [libc][NFC] Fix GCC inline asm compilation problems + workaround clang assertion

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jan 25 08:40:28 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGce368e1aa51f: [libc][NFC] Workaround clang assertion in inline asm (authored by abrachet).
Herald added a project: libc-project.
Herald added a subscriber: libc-commits.

Changed prior to commit:
  https://reviews.llvm.org/D118099?vs=402758&id=402934#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118099/new/

https://reviews.llvm.org/D118099

Files:
  libc/src/math/x86_64/cos.cpp
  libc/src/math/x86_64/sin.cpp
  libc/src/math/x86_64/tan.cpp


Index: libc/src/math/x86_64/tan.cpp
===================================================================
--- libc/src/math/x86_64/tan.cpp
+++ libc/src/math/x86_64/tan.cpp
@@ -16,7 +16,7 @@
   double one;
   // The fptan instruction pushes the number 1 on to the FP stack after
   // computing tan. So, we read out the one before popping the actual result.
-  __asm__ __volatile__("fptan" : "=t"(one) : "f"(x));
+  __asm__ __volatile__("fptan" : "=t"(one) : "f"(x) : "cc");
   __asm__ __volatile__("fstpl %0" : "=m"(result));
   return result;
 }
Index: libc/src/math/x86_64/sin.cpp
===================================================================
--- libc/src/math/x86_64/sin.cpp
+++ libc/src/math/x86_64/sin.cpp
@@ -13,7 +13,7 @@
 
 LLVM_LIBC_FUNCTION(double, sin, (double x)) {
   double result;
-  __asm__ __volatile__("fsin" : "=t"(result) : "f"(x));
+  __asm__ __volatile__("fsin" : "=t"(result) : "f"(x) : "cc");
   return result;
 }
 
Index: libc/src/math/x86_64/cos.cpp
===================================================================
--- libc/src/math/x86_64/cos.cpp
+++ libc/src/math/x86_64/cos.cpp
@@ -13,7 +13,7 @@
 
 LLVM_LIBC_FUNCTION(double, cos, (double x)) {
   double result;
-  __asm__ __volatile__("fcos" : "=t"(result) : "f"(x));
+  __asm__ __volatile__("fcos" : "=t"(result) : "f"(x) : "cc");
   return result;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118099.402934.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220125/86c34415/attachment.bin>


More information about the libc-commits mailing list