[libc][NFC] Workaround clang assertion in inline asm

The clobber list "cc" is added to inline assembly to workaround a clang assertion that triggers when building with a clang built with assertions enabled. See bug [53391](https://github.com/llvm/llvm-project/issues/53391).

See https://godbolt.org/z/z3bc6a9PM showing functionally same output assembly.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D118099
This commit is contained in:
Alex Brachet 2022-01-25 16:37:43 +00:00
parent 64ba462b6e
commit ce368e1aa5
3 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ namespace __llvm_libc {
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;
}

View File

@ -13,7 +13,7 @@ namespace __llvm_libc {
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;
}

View File

@ -16,7 +16,7 @@ LLVM_LIBC_FUNCTION(double, tan, (double x)) {
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;
}