Get codebase completely working with LLVM

You can now build Cosmopolitan with Clang:

    make -j8 MODE=llvm
    o/llvm/examples/hello.com

The assembler and linker code is now friendly to LLVM too.
So it's not needed to configure Clang to use binutils under
the hood. If you love LLVM then you can now use pure LLVM.
This commit is contained in:
Justine Tunney 2021-02-08 09:19:00 -08:00
parent 0e36cb3ac4
commit e75ffde09e
4528 changed files with 7776 additions and 11640 deletions

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc cosine of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Returns arc cosine of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
acos: ezlea acosl,ax
jmp _d2ld2
.endfn acos,globl

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc cosine of 𝑥.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns arc cosine of 𝑥.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
acosf: ezlea acosl,ax
jmp _f2ld2
.endfn acosf,globl

View file

@ -19,13 +19,13 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc cosine of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of computation on FPU stack in %st
/ @define atan2(abs(sqrt((1-𝑥)*(1+𝑥))),𝑥)
/ @domain -1 ≤ 𝑥 ≤ 1
/ @mode long,legacy
// Returns arc cosine of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of computation on FPU stack in %st
// @define atan2(abs(sqrt((1-𝑥)*(1+𝑥))),𝑥)
// @domain -1 ≤ 𝑥 ≤ 1
// @mode long,legacy
acosl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc sine of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Returns arc sine of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
asin: ezlea asinl,ax
jmp _d2ld2
.endfn asin,globl

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc sine of 𝑥.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns arc sine of 𝑥.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
asinf: ezlea asinl,ax
jmp _f2ld2
.endfn asinf,globl

View file

@ -19,13 +19,13 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc sine of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of computation on FPU stack in %st
/ @define atan2(𝑥,sqrt((1-𝑥)*(1+𝑥)))
/ @domain -1 ≤ 𝑥 ≤ 1
/ @mode long,legacy
// Returns arc sine of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of computation on FPU stack in %st
// @define atan2(𝑥,sqrt((1-𝑥)*(1+𝑥)))
// @domain -1 ≤ 𝑥 ≤ 1
// @mode long,legacy
asinl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc tangent of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Returns arc tangent of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
atan: ezlea atanl,ax
jmp _d2ld2
.endfn atan,globl

View file

@ -19,12 +19,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc tangent of 𝑦/𝑥.
/
/ @param 𝑦 is double scalar in low half of %xmm0
/ @param 𝑥 is double scalar in low half of %xmm1
/ @return double scalar in low half of %xmm0
/ @note the greatest of all libm functions
// Returns arc tangent of 𝑦/𝑥.
//
// @param 𝑦 is double scalar in low half of %xmm0
// @param 𝑥 is double scalar in low half of %xmm1
// @return double scalar in low half of %xmm0
// @note the greatest of all libm functions
atan2: ezlea atan2l,ax
jmp _d2ld2
.endfn atan2,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc tangent of 𝑦/𝑥.
/
/ @param 𝑦 is float scalar in low quarter of %xmm0
/ @param 𝑥 is float scalar in low quarter of %xmm1
/ @return float scalar in low quarter of %xmm0
// Returns arc tangent of 𝑦/𝑥.
//
// @param 𝑦 is float scalar in low quarter of %xmm0
// @param 𝑥 is float scalar in low quarter of %xmm1
// @return float scalar in low quarter of %xmm0
atan2f: ezlea atan2l,ax
jmp _f2ld2
.endfn atan2f,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc tangent of 𝑦/𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @param 𝑦 is an 80-bit long double passed on stack in 16-bytes
/ @return result of computation on FPU stack in %st
// Returns arc tangent of 𝑦/𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @param 𝑦 is an 80-bit long double passed on stack in 16-bytes
// @return result of computation on FPU stack in %st
atan2l: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc tangent of 𝑥.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns arc tangent of 𝑥.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
atanf: ezlea atanl,ax
jmp _f2ld2
.endfn atanf,globl

View file

@ -19,15 +19,15 @@
#include "libc/macros.h"
.source __FILE__
/ Returns arc tangent of 𝑥.
/
/ 1 3 1 5 1 7 1 9 1 11
/ atan(𝑥) = 𝑥 - - 𝑥 + - 𝑥 - - 𝑥 + - 𝑥 - -- 𝑥 ...
/ 3 5 7 9 11
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of computation on FPU stack in %st
/ @define atan(𝑥) = Σₙ₌₀₋∞ 2²ⁿ(𝑛!)²/(𝟸𝑛+𝟷)!(𝑥²ⁿ⁺¹/(𝑥²+𝟷)ⁿ⁺¹)
// Returns arc tangent of 𝑥.
//
// 1 3 1 5 1 7 1 9 1 11
// atan(𝑥) = 𝑥 - - 𝑥 + - 𝑥 - - 𝑥 + - 𝑥 - -- 𝑥 ...
// 3 5 7 9 11
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of computation on FPU stack in %st
// @define atan(𝑥) = Σₙ₌₀₋∞ 2²ⁿ(𝑛!)²/(𝟸𝑛+𝟷)!(𝑥²ⁿ⁺¹/(𝑥²+𝟷)ⁿ⁺¹)
atanl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -20,12 +20,12 @@
#include "libc/macros.h"
.source __FILE__
/ Computes transcedental trigonometry op w/ reactive scaling.
/
/ @param %rdx points to op function
/ @param everything else delegates
/ @clob %ax
/ @see sin,cos,tan
// Computes transcedental trigonometry op w/ reactive scaling.
//
// @param %rdx points to op function
// @param everything else delegates
// @clob %ax
// @see sin,cos,tan
c2rangr:push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,6 +19,6 @@
#include "libc/macros.h"
.source __FILE__
/ Returns absolute value of complex number.
// Returns absolute value of complex number.
cabs: jmp hypot
.endfn cabs,globl

View file

@ -18,10 +18,10 @@
*/
#include "libc/macros.h"
/ Returns cube root of 𝑥.
/
/ @param %xmm0 holds binary64 number
/ @return %xmm0 holds binary64 result
// Returns cube root of 𝑥.
//
// @param %xmm0 holds binary64 number
// @return %xmm0 holds binary64 result
cbrt: jmp __cbrt
.endfn cbrt,globl
.source __FILE__

View file

@ -18,10 +18,10 @@
*/
#include "libc/macros.h"
/ Returns cube root of 𝑥.
/
/ @param %xmm0 holds binary32 number
/ @return %xmm0 holds binary32 result
// Returns cube root of 𝑥.
//
// @param %xmm0 holds binary32 number
// @return %xmm0 holds binary32 result
cbrtf: pushq %rbp
mov %rsp,%rbp
cvtss2sd %xmm0,%xmm0

View file

@ -18,10 +18,10 @@
*/
#include "libc/macros.h"
/ Returns cube root of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of computation on FPU stack in %st
// Returns cube root of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of computation on FPU stack in %st
cbrtl: pushq %rbp
mov %rsp,%rbp
sub $16,%rsp

View file

@ -38,7 +38,7 @@ ceil: .leafprologue
.rodata.cst8
nan: .double nan
sig: .double 0x0010000000000000
sig: .quad 0x0010000000000000
one: .double 1
/ vroundsd $_MM_FROUND_TO_POS_INF|_MM_FROUND_NO_EXC,%xmm0,%xmm0,%xmm0
// vroundsd $_MM_FROUND_TO_POS_INF|_MM_FROUND_NO_EXC,%xmm0,%xmm0,%xmm0

View file

@ -46,5 +46,5 @@ ceilf: .leafprologue
.long 0
.long 0
/ TODO(jart):
/ vroundss $10,%xmm0,%xmm0,%xmm0
// TODO(jart):
// vroundss $10,%xmm0,%xmm0,%xmm0

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns cosine of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns cosine of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
cos: ezlea cosl,ax
jmp _d2ld2
.endfn cos,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns cosine of 𝑥.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns cosine of 𝑥.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
cosf: ezlea cosl,ax
jmp _f2ld2
.endfn cosf,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns cosine of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
/ @return %st stores result
// Returns cosine of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// @return %st stores result
cosl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Projects into Rienmann sphere.
/
/ @param z is complex long double passed on stack
/ @note needs sse3
// Projects into Rienmann sphere.
//
// @param z is complex long double passed on stack
// @note needs sse3
cprojl: .profilable
sub $24,%rsp
fldt 32(%rsp)

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Thunks double(*fn)(double,double) -> long double fn.
/
/ @param %xmm0[0] contains double param
/ @return %xmm0[0] contains double result
/ @note 100% negligible overhead
// Thunks double(*fn)(double,double) -> long double fn.
//
// @param %xmm0[0] contains double param
// @return %xmm0[0] contains double result
// @note 100% negligible overhead
_d2ld2: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑒^x.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns 𝑒^x.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
exp: ezlea expl,ax
jmp _d2ld2
.endfn exp,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 10^x.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
/ @see pow(), exp()
// Returns 10^x.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
// @see pow(), exp()
exp10:
ezlea exp10l,ax
jmp _d2ld2

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 10^x.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns 10^x.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
exp10f:
ezlea exp10l,ax
jmp _f2ld2

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 10^x.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of exponentiation on FPU stack in %st
// Returns 10^x.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of exponentiation on FPU stack in %st
exp10l:
push %rbp
mov %rsp,%rbp

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 2^𝑥.
/
/ @param 𝑥 is a double passed in the lower quadword of %xmm0
/ @return result in lower quadword of %xmm0
// Returns 2^𝑥.
//
// @param 𝑥 is a double passed in the lower quadword of %xmm0
// @return result in lower quadword of %xmm0
exp2:
ezlea exp2l,ax
jmp _d2ld2

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 2^𝑥.
/
/ @param 𝑥 is a float passed in the lower quarter of %xmm0
/ @return result in lower quarter of %xmm0
// Returns 2^𝑥.
//
// @param 𝑥 is a float passed in the lower quarter of %xmm0
// @return result in lower quarter of %xmm0
exp2f:
ezlea exp2l,ax
jmp _f2ld2

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 2^𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of exponentiation on FPU stack in %st
// Returns 2^𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of exponentiation on FPU stack in %st
exp2l: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑒^x.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Returns 𝑒^x.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
expf: ezlea expl,ax
jmp _f2ld2
.endfn expf,globl

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑒^x.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of exponentiation on FPU stack in %st
// Returns 𝑒^x.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of exponentiation on FPU stack in %st
expl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑒^x-1.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Returns 𝑒^x-1.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
expm1:
ezlea expm1l,ax
jmp _d2ld2

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑒^x-1.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns 𝑒^x-1.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
expm1f: ezlea expm1l,ax
jmp _f2ld2
.endfn expm1f,globl

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑒^x-1.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of exponentiation on FPU stack in %st
// Returns 𝑒^x-1.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of exponentiation on FPU stack in %st
expm1l:
push %rbp
mov %rsp,%rbp

View file

@ -18,11 +18,11 @@
*/
#include "libc/macros.h"
/ Thunks float(*fn)(float,float) -> long double fn.
/
/ @param %xmm0[0] contains float param
/ @return %xmm0[0] contains float result
/ @note 100% negligible overhead
// Thunks float(*fn)(float,float) -> long double fn.
//
// @param %xmm0[0] contains float param
// @return %xmm0[0] contains float result
// @note 100% negligible overhead
_f2ld2: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns absolute value of 𝑥.
/
/ @param 𝑥 is double passed in lower half on %xmm0
/ @return absolute value in %xmm0
// Returns absolute value of 𝑥.
//
// @param 𝑥 is double passed in lower half on %xmm0
// @return absolute value in %xmm0
fabs: .leafprologue
.profilable
mov $0x7fffffffffffffff,%rax

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns absolute value of 𝑥.
/
/ @param 𝑥 is float passed in lower quarter on %xmm0
/ @return absolute value in %xmm0
// Returns absolute value of 𝑥.
//
// @param 𝑥 is float passed in lower quarter on %xmm0
// @return absolute value in %xmm0
fabsf: .leafprologue
.profilable
movd %xmm0,%eax

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns absolute value of 𝑥.
/
/ @param 𝑥 long double passed on stack
/ @return absolute value in %st
// Returns absolute value of 𝑥.
//
// @param 𝑥 long double passed on stack
// @return absolute value in %st
fabsl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,7 +19,7 @@
#include "libc/macros.h"
.source __FILE__
/ vroundsd $_MM_FROUND_TO_NEG_INF|_MM_FROUND_NO_EXC,%xmm0,%xmm0,%xmm0
// vroundsd $_MM_FROUND_TO_NEG_INF|_MM_FROUND_NO_EXC,%xmm0,%xmm0,%xmm0
floor: .leafprologue
.profilable
@ -43,5 +43,5 @@ floor: .leafprologue
.rodata.cst8
2: .double 1
3: .double 0x0010000000000000
3: .quad 0x0010000000000000
4: .double nan

View file

@ -19,13 +19,13 @@
#include "libc/macros.h"
.source __FILE__
/ fmod [sic] does (𝑥 rem 𝑦) w/ round()-style rounding.
/
/ @param 𝑥 is double passed in lower half of %xmm0
/ @param 𝑦 is double passed in lower half of %xmm1
/ @return remainder ∈ (-|𝑦|,|𝑦|) in %xmm0
/ @define 𝑥-trunc(𝑥/𝑦)*𝑦
/ @see emod()
// fmod [sic] does (𝑥 rem 𝑦) w/ round()-style rounding.
//
// @param 𝑥 is double passed in lower half of %xmm0
// @param 𝑦 is double passed in lower half of %xmm1
// @return remainder ∈ (-|𝑦|,|𝑦|) in %xmm0
// @define 𝑥-trunc(𝑥/𝑦)*𝑦
// @see emod()
fmod: ezlea fmodl,ax
jmp _d2ld2
.endfn fmod,globl

View file

@ -19,7 +19,7 @@
#include "libc/macros.h"
.source __FILE__
/ Returns euclidean distance in 2d space.
// Returns euclidean distance in 2d space.
hypot: .leafprologue
.profilable
mulsd %xmm1,%xmm1

View file

@ -19,7 +19,7 @@
#include "libc/macros.h"
.source __FILE__
/ Returns euclidean distance in 2d space.
// Returns euclidean distance in 2d space.
hypotf: .leafprologue
.profilable
mulss %xmm1,%xmm1

View file

@ -19,7 +19,7 @@
#include "libc/macros.h"
.source __FILE__
/ Returns euclidean distance in 2d space.
// Returns euclidean distance in 2d space.
hypotl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -18,11 +18,11 @@
*/
#include "libc/macros.h"
/ Returns log𝑥 exponent part of double.
/
/ @param 𝑥 is double passed in %xmm0
/ @return result in %eax
/ @note needs sse3
// Returns log𝑥 exponent part of double.
//
// @param 𝑥 is double passed in %xmm0
// @return result in %eax
// @note needs sse3
ilogb: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -18,11 +18,11 @@
*/
#include "libc/macros.h"
/ Returns logx exponent part of float.
/
/ @param 𝑥 is float passed in %xmm0
/ @return result in %eax
/ @note needs sse3
// Returns logx exponent part of float.
//
// @param 𝑥 is float passed in %xmm0
// @return result in %eax
// @note needs sse3
ilogbf: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -18,11 +18,11 @@
*/
#include "libc/macros.h"
/ Returns logx exponent part of long double.
/
/ @param 𝑥 is long double passed on stack
/ @return result in %eax
/ @note needs sse3
// Returns logx exponent part of long double.
//
// @param 𝑥 is long double passed on stack
// @return result in %eax
// @note needs sse3
ilogbl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥 × 2ʸ.
/
/ @param 𝑥 is double passed in %xmm0
/ @param 𝑦 is exponent via %edi
/ @return double in %xmm0
// Returns 𝑥 × 2ʸ.
//
// @param 𝑥 is double passed in %xmm0
// @param 𝑦 is exponent via %edi
// @return double in %xmm0
ldexp: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥 × 2ʸ.
/
/ @param 𝑥 is float passed in %xmm0
/ @param 𝑦 is exponent via %edi
/ @return float in %xmm0
// Returns 𝑥 × 2ʸ.
//
// @param 𝑥 is float passed in %xmm0
// @param 𝑦 is exponent via %edi
// @return float in %xmm0
ldexpf: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥 × 2ʸ.
/
/ @param 𝑥 is long double passed on stack
/ @param 𝑦 is exponent via %edi
/ @return result in %st0
// Returns 𝑥 × 2ʸ.
//
// @param 𝑥 is long double passed on stack
// @param 𝑦 is exponent via %edi
// @return result in %st0
ldexpl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns natural logarithm of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Returns natural logarithm of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
log: ezlea logl,ax
jmp _d2ld2
.endfn log,globl

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Calculates log𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Calculates log𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
log10:
ezlea log10l,ax
jmp _d2ld2

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Calculates log𝑥.
/
/ @param 𝑥 is double scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Calculates log𝑥.
//
// @param 𝑥 is double scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
log10f:
ezlea log10l,ax
jmp _f2ld2

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Calculates log𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result in %st
// Calculates log𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result in %st
log10l: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns log(𝟷+𝑥).
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
// Returns log(𝟷+𝑥).
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
log1p:
push %rbp
mov %rsp,%rbp

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns log(𝟷+𝑥).
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns log(𝟷+𝑥).
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
log1pf: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns log(𝟷+𝑥).
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of exponentiation on FPU stack in %st
// Returns log(𝟷+𝑥).
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of exponentiation on FPU stack in %st
log1pl:
push %rbp
mov %rsp,%rbp

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Calculates log𝑥.
/
/ @param 𝑥 is a double passed in the lower quadword of %xmm0
/ @return result in lower quadword of %xmm0
// Calculates log𝑥.
//
// @param 𝑥 is a double passed in the lower quadword of %xmm0
// @return result in lower quadword of %xmm0
log2:
push %rbp
mov %rsp,%rbp

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Calculates log𝑥.
/
/ @param 𝑥 is a float passed in the lower quarter of %xmm0
/ @return result in lower quarter of %xmm0
// Calculates log𝑥.
//
// @param 𝑥 is a float passed in the lower quarter of %xmm0
// @return result in lower quarter of %xmm0
log2f:
push %rbp
mov %rsp,%rbp

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Calculates log𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result in %st
/ @see ilogbl()
// Calculates log𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result in %st
// @see ilogbl()
log2l:
push %rbp
mov %rsp,%rbp

View file

@ -18,10 +18,10 @@
*/
#include "libc/macros.h"
/ Returns log exponent part of double.
/
/ @param 𝑥 is double passed in %xmm0
/ @return result in %xmm0
// Returns log exponent part of double.
//
// @param 𝑥 is double passed in %xmm0
// @return result in %xmm0
logb: ezlea logbl,ax
jmp _d2ld2
.endfn logb,globl

View file

@ -18,10 +18,10 @@
*/
#include "libc/macros.h"
/ Returns log exponent part of float.
/
/ @param 𝑥 is float passed in %xmm0
/ @return result in %xmm0
// Returns log exponent part of float.
//
// @param 𝑥 is float passed in %xmm0
// @return result in %xmm0
logbf: ezlea logbl,ax
jmp _f2ld2
.endfn logbf,globl

View file

@ -18,10 +18,10 @@
*/
#include "libc/macros.h"
/ Returns log exponent part of long double.
/
/ @param 𝑥 is long double passed on stack
/ @return result in %st0
// Returns log exponent part of long double.
//
// @param 𝑥 is long double passed on stack
// @return result in %st0
logbl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns natural logarithm of 𝑥.
/
/ @param 𝑥 is double scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Returns natural logarithm of 𝑥.
//
// @param 𝑥 is double scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
logf: ezlea logl,ax
jmp _f2ld2
.endfn logf,globl

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns natural logarithm of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result on FPU stack in %st
// Returns natural logarithm of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result on FPU stack in %st
logl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Rounds to nearest integer, away from zero.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return 64-bit signed integer in %rax
/ @see round(), lrint()
// Rounds to nearest integer, away from zero.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return 64-bit signed integer in %rax
// @see round(), lrint()
lround: .leafprologue
.profilable
movsd A(%rip),%xmm2

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Rounds to nearest integer, away from zero.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return 64-bit signed integer in %rax
/ @see round()
// Rounds to nearest integer, away from zero.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return 64-bit signed integer in %rax
// @see round()
lroundf:
.leafprologue
.profilable

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥^𝑦.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @param 𝑦 is double scalar in low half of %xmm1
/ @return double scalar in low half of %xmm0
// Returns 𝑥^𝑦.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @param 𝑦 is double scalar in low half of %xmm1
// @return double scalar in low half of %xmm0
pow: ezlea powl,ax
jmp _d2ld2
.endfn pow,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥^𝑦.
/
/ @param 𝑦 is float scalar in low quarter of %xmm0
/ @param 𝑥 is float scalar in low quarter of %xmm1
/ @return float scalar in low quarter of %xmm0
// Returns 𝑥^𝑦.
//
// @param 𝑦 is float scalar in low quarter of %xmm0
// @param 𝑥 is float scalar in low quarter of %xmm1
// @return float scalar in low quarter of %xmm0
powf: ezlea powl,ax
jmp _f2ld2
.endfn powf,globl

View file

@ -18,11 +18,11 @@
*/
#include "libc/macros.h"
/ Returns 𝑥^𝑦.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @param 𝑦 is int passed in %edi
/ @return double scalar in low half of %xmm0
// Returns 𝑥^𝑦.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @param 𝑦 is int passed in %edi
// @return double scalar in low half of %xmm0
powi: cvtsi2sd %edi,%xmm1
jmp pow
.endfn powi,globl

View file

@ -18,11 +18,11 @@
*/
#include "libc/macros.h"
/ Returns 𝑥^𝑦.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @param 𝑦 is int passed in %edi
/ @return double scalar in low half of %xmm0
// Returns 𝑥^𝑦.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @param 𝑦 is int passed in %edi
// @return double scalar in low half of %xmm0
powif: cvtsi2ss %edi,%xmm1
jmp pow
.endfn powif,globl

View file

@ -18,11 +18,11 @@
*/
#include "libc/macros.h"
/ Returns 𝑥^𝑦.
/
/ @param 𝑥 is long double passed on stack
/ @param 𝑦 is int passed in %edi
/ @return %st
// Returns 𝑥^𝑦.
//
// @param 𝑥 is long double passed on stack
// @param 𝑦 is int passed in %edi
// @return %st
powil: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,12 +19,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥^𝑦.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @param 𝑦 is the power, also pushed on stack, in reverse order
/ @return result of exponentiation on FPU stack in %st
/ @note Sun's fdlibm needs 2kLOC to do this for RISC lool
// Returns 𝑥^𝑦.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @param 𝑦 is the power, also pushed on stack, in reverse order
// @return result of exponentiation on FPU stack in %st
// @note Sun's fdlibm needs 2kLOC to do this for RISC lool
powl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,13 +19,13 @@
#include "libc/macros.h"
.source __FILE__
/ remainder(𝑥,𝑦) means (𝑥 rem 𝑦) w/ rint()-style rounding.
/
/ @param 𝑥 is double passed in lower half of %xmm0
/ @param 𝑦 is double passed in lower half of %xmm1
/ @return remainder ∈ (-|𝑦|,|𝑦|) in %xmm0
/ @define 𝑥-rint(𝑥/𝑦)*𝑦
/ @see fmod(), emod(), operator%
// remainder(𝑥,𝑦) means (𝑥 rem 𝑦) w/ rint()-style rounding.
//
// @param 𝑥 is double passed in lower half of %xmm0
// @param 𝑦 is double passed in lower half of %xmm1
// @return remainder ∈ (-|𝑦|,|𝑦|) in %xmm0
// @define 𝑥-rint(𝑥/𝑦)*𝑦
// @see fmod(), emod(), operator%
remainder:
ezlea remainderl,ax
jmp _d2ld2

View file

@ -21,11 +21,11 @@
#include "libc/macros.h"
.source __FILE__
/ Rounds to nearest integer.
/
/ @param is double passed in %xmm0
/ @return double in %xmm0
/ @note rounding behavior can be changed in mxcsr
// Rounds to nearest integer.
//
// @param is double passed in %xmm0
// @return double in %xmm0
// @note rounding behavior can be changed in mxcsr
rint:
#if !X86_NEED(SSE4_2)
testb X86_HAVE(SSE4_2)+kCpuids(%rip)

View file

@ -44,5 +44,5 @@ rintf: .leafprologue
.long 0
.long 0
/ TODO(jart):
/ vroundss $4,%xmm0,%xmm0,%xmm0
// TODO(jart):
// vroundss $4,%xmm0,%xmm0,%xmm0

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Rounds to nearest integer.
/
/ @param is long double passed on stack
/ @return long double in %st
/ @note rounding behavior can be changed in control word
// Rounds to nearest integer.
//
// @param is long double passed on stack
// @return long double in %st
// @note rounding behavior can be changed in control word
rintl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -21,12 +21,12 @@
#include "libc/nexgen32e/x86feature.h"
.source __FILE__
/ Rounds to nearest integer, away from zero.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
/ @define round(𝑥) = copysign(trunc(fabs(𝑥)+.5),𝑥)
/ round(𝑥) = trunc(𝑥+copysign(.5,𝑥))
// Rounds to nearest integer, away from zero.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
// @define round(𝑥) = copysign(trunc(fabs(𝑥)+.5),𝑥)
// round(𝑥) = trunc(𝑥+copysign(.5,𝑥))
round:
#if !X86_NEED(SSE4_2)
testb X86_HAVE(SSE4_2)+kCpuids(%rip)

View file

@ -21,10 +21,10 @@
#include "libc/nexgen32e/x86feature.h"
.source __FILE__
/ Rounds to nearest integer, away from zero.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
// Rounds to nearest integer, away from zero.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
roundf:
#if !X86_NEED(SSE4_2)
testb X86_HAVE(SSE4_2)+kCpuids(%rip)

View file

@ -19,10 +19,10 @@
#include "ape/lib/pc.h"
#include "libc/macros.h"
/ Rounds to nearest integer, away from zero.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result of exponentiation on FPU stack in %st
// Rounds to nearest integer, away from zero.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result of exponentiation on FPU stack in %st
roundl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,12 +19,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥 × 2ʸ.
/
/ @param 𝑥 is double passed in %xmm0
/ @param 𝑦 is double passed in %xmm1, which is truncated
/ @return result in %xmm0
/ @see ldexp()
// Returns 𝑥 × 2ʸ.
//
// @param 𝑥 is double passed in %xmm0
// @param 𝑦 is double passed in %xmm1, which is truncated
// @return result in %xmm0
// @see ldexp()
scalb: cvttsd2si %xmm1,%edi
jmp ldexp
.endfn scalb,globl

View file

@ -19,12 +19,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥 × 2ʸ.
/
/ @param 𝑥 is float passed in %xmm0
/ @param 𝑦 is float passed in %xmm1, which is truncated
/ @return result in %xmm0
/ @see ldexpf()
// Returns 𝑥 × 2ʸ.
//
// @param 𝑥 is float passed in %xmm0
// @param 𝑦 is float passed in %xmm1, which is truncated
// @return result in %xmm0
// @see ldexpf()
scalbf: cvttss2si %xmm1,%edi
jmp ldexpf
.endfn scalbf,globl

View file

@ -19,12 +19,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns 𝑥 × 2ʸ.
/
/ @param 𝑥 is long double passed on stack
/ @param 𝑦 is long double passed on stack
/ @return result in %st0
/ @see ldexpl()
// Returns 𝑥 × 2ʸ.
//
// @param 𝑥 is long double passed on stack
// @param 𝑦 is long double passed on stack
// @return result in %st0
// @see ldexpl()
scalbl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns sine of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns sine of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
sin: ezlea sinl,ax
jmp _d2ld2
.endfn sin,globl

View file

@ -19,12 +19,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns sine and cosine of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @param %rdi is double *out_sin
/ @param %rsi is double *out_cos
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns sine and cosine of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @param %rdi is double *out_sin
// @param %rsi is double *out_cos
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
sincos: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,12 +19,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns sine and cosine of 𝑥.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @param %rdi is float *out_sin
/ @param %rsi is float *out_cos
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns sine and cosine of 𝑥.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @param %rdi is float *out_sin
// @param %rsi is float *out_cos
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
sincosf:
push %rbp
mov %rsp,%rbp

View file

@ -20,12 +20,12 @@
#include "libc/macros.h"
.source __FILE__
/ Returns sine and cosine of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @param %rdi is long double *out_sin
/ @param %rsi is long double *out_cos
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns sine and cosine of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @param %rdi is long double *out_sin
// @param %rsi is long double *out_cos
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
sincosl:
push %rbp
mov %rsp,%rbp

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns sine of 𝑥.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns sine of 𝑥.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
sinf: ezlea sinl,ax
jmp _f2ld2
.endfn sinf,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns sine of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
/ @return %st stores result
// Returns sine of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// @return %st stores result
sinl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns square root of 𝑥.
/
/ @param 𝑥 is an double passed in %xmm0
/ @return result in %xmm0
// Returns square root of 𝑥.
//
// @param 𝑥 is an double passed in %xmm0
// @return result in %xmm0
sqrt: .leafprologue
.profilable
sqrtsd %xmm0,%xmm0

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns square root of 𝑥.
/
/ @param 𝑥 is an float passed in %xmm0
/ @return result in %xmm0
// Returns square root of 𝑥.
//
// @param 𝑥 is an float passed in %xmm0
// @return result in %xmm0
sqrtf: .leafprologue
.profilable
sqrtss %xmm0,%xmm0

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns square root of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return result on FPU stack in %st
// Returns square root of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return result on FPU stack in %st
sqrtl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns tangent of 𝑥.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns tangent of 𝑥.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
tan: ezlea tanl,ax
jmp _d2ld2
.endfn tan,globl

View file

@ -19,11 +19,11 @@
#include "libc/macros.h"
.source __FILE__
/ Returns tangent of 𝑥.
/
/ @param 𝑥 is float scalar in low quarter of %xmm0
/ @return float scalar in low quarter of %xmm0
/ @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
// Returns tangent of 𝑥.
//
// @param 𝑥 is float scalar in low quarter of %xmm0
// @return float scalar in low quarter of %xmm0
// @domain -(3π/8) < 𝑥 < 3π/8 for best accuracy
tanf: ezlea tanl,ax
jmp _f2ld2
.endfn tanf,globl

View file

@ -20,10 +20,10 @@
#include "libc/macros.h"
.source __FILE__
/ Returns tangent of 𝑥.
/
/ @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
/ @return %st stores result
// Returns tangent of 𝑥.
//
// @param 𝑥 is an 80-bit long double passed on stack in 16-bytes
// @return %st stores result
tanl: push %rbp
mov %rsp,%rbp
.profilable

View file

@ -19,13 +19,13 @@
#include "libc/macros.h"
.source __FILE__
/ Rounds to integer, toward zero.
/
/ @param 𝑥 is double scalar in low half of %xmm0
/ @return double scalar in low half of %xmm0
/ @define trunc(𝑥+copysign(.5,𝑥))
/ @see round(),rint(),nearbyint()
/ @see roundsd $_MM_FROUND_TO_ZERO|_MM_FROUND_NO_EXC,%xmm0,%xmm0
// Rounds to integer, toward zero.
//
// @param 𝑥 is double scalar in low half of %xmm0
// @return double scalar in low half of %xmm0
// @define trunc(𝑥+copysign(.5,𝑥))
// @see round(),rint(),nearbyint()
// @see roundsd $_MM_FROUND_TO_ZERO|_MM_FROUND_NO_EXC,%xmm0,%xmm0
trunc: .leafprologue
.profilable
movsd 3f(%rip),%xmm1
@ -40,5 +40,5 @@ trunc: .leafprologue
.endfn trunc,globl
.rodata.cst8
2: .double 0x0010000000000000
2: .quad 0x0010000000000000
3: .double nan

View file

@ -37,5 +37,5 @@ truncf: .leafprologue
.rodata.cst16
3: .long 0x7fffffff,0,0,0
/ TODO(jart)
/ roundss $_MM_FROUND_TO_ZERO|_MM_FROUND_NO_EXC,%xmm0,%xmm0
// TODO(jart)
// roundss $_MM_FROUND_TO_ZERO|_MM_FROUND_NO_EXC,%xmm0,%xmm0