[libc-commits] [PATCH] D119978: [libc] Use '+' constraint on inline assembly

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Feb 16 19:00:52 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG64f5f6d7592c: [libc] Use '+' constraint on inline assembly (authored by abrachet).
Herald added a project: libc-project.
Herald added a subscriber: libc-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119978

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
@@ -13,10 +13,9 @@
 
 LLVM_LIBC_FUNCTION(double, tan, (double x)) {
   double result;
-  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) : "cc");
+  __asm__ __volatile__("fptan" : "+t"(x));
   __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
@@ -12,9 +12,8 @@
 namespace __llvm_libc {
 
 LLVM_LIBC_FUNCTION(double, sin, (double x)) {
-  double result;
-  __asm__ __volatile__("fsin" : "=t"(result) : "f"(x) : "cc");
-  return result;
+  __asm__ __volatile__("fsin" : "+t"(x));
+  return x;
 }
 
 } // namespace __llvm_libc
Index: libc/src/math/x86_64/cos.cpp
===================================================================
--- libc/src/math/x86_64/cos.cpp
+++ libc/src/math/x86_64/cos.cpp
@@ -12,9 +12,8 @@
 namespace __llvm_libc {
 
 LLVM_LIBC_FUNCTION(double, cos, (double x)) {
-  double result;
-  __asm__ __volatile__("fcos" : "=t"(result) : "f"(x) : "cc");
-  return result;
+  __asm__ __volatile__("fcos" : "+t"(x));
+  return x;
 }
 
 } // namespace __llvm_libc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119978.409471.patch
Type: text/x-patch
Size: 1504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220217/5467c598/attachment.bin>


More information about the libc-commits mailing list