[libc-commits] [libc] 64f5f6d - [libc] Use '+' constraint on inline assembly
Alex Brachet via libc-commits
libc-commits at lists.llvm.org
Wed Feb 16 19:00:45 PST 2022
Author: Alex Brachet
Date: 2022-02-17T03:00:17Z
New Revision: 64f5f6d7592cb0c346759d60e507c23295585de0
URL: https://github.com/llvm/llvm-project/commit/64f5f6d7592cb0c346759d60e507c23295585de0
DIFF: https://github.com/llvm/llvm-project/commit/64f5f6d7592cb0c346759d60e507c23295585de0.diff
LOG: [libc] Use '+' constraint on inline assembly
As suggested by @mcgrathr in D118099
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D119978
Added:
Modified:
libc/src/math/x86_64/cos.cpp
libc/src/math/x86_64/sin.cpp
libc/src/math/x86_64/tan.cpp
Removed:
################################################################################
diff --git a/libc/src/math/x86_64/cos.cpp b/libc/src/math/x86_64/cos.cpp
index 3b785a2f78cdf..1d2480e3df147 100644
--- a/libc/src/math/x86_64/cos.cpp
+++ b/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
diff --git a/libc/src/math/x86_64/sin.cpp b/libc/src/math/x86_64/sin.cpp
index e94aa1a3f0925..bda4acbe41223 100644
--- a/libc/src/math/x86_64/sin.cpp
+++ b/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
diff --git a/libc/src/math/x86_64/tan.cpp b/libc/src/math/x86_64/tan.cpp
index 0503af7a16dde..f25ff77095c88 100644
--- a/libc/src/math/x86_64/tan.cpp
+++ b/libc/src/math/x86_64/tan.cpp
@@ -13,10 +13,9 @@ namespace __llvm_libc {
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;
}
More information about the libc-commits
mailing list