提交 6bbdbfdc 编写于 作者: A Alexander Monakov 提交者: Rich Felker

math: move x86_64 (l)lrint(f) functions to C with inline asm

上级 acfe6d03
#include <math.h>
long long llrint(double x)
{
long long r;
__asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x));
return r;
}
.global llrint
.type llrint,@function
llrint:
cvtsd2si %xmm0,%rax
ret
#include <math.h>
long long llrintf(float x)
{
long long r;
__asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x));
return r;
}
.global llrintf
.type llrintf,@function
llrintf:
cvtss2si %xmm0,%rax
ret
#include <math.h>
long lrint(double x)
{
long r;
__asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x));
return r;
}
.global lrint
.type lrint,@function
lrint:
cvtsd2si %xmm0,%rax
ret
#include <math.h>
long lrintf(float x)
{
long r;
__asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x));
return r;
}
.global lrintf
.type lrintf,@function
lrintf:
cvtss2si %xmm0,%rax
ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册