forked from OSchip/llvm-project
[libc] Use '+' constraint on inline assembly
As suggested by @mcgrathr in D118099 Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D119978
This commit is contained in:
parent
dd8490d207
commit
64f5f6d759
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue