Add more libm unit tests and fixes

See #61
This commit is contained in:
Justine Tunney 2021-03-02 13:57:23 -08:00
parent 32e289b1d8
commit 9367253b4d
15 changed files with 390 additions and 124 deletions

View file

@ -17,19 +17,24 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.source __FILE__
ceill: .profilable
sub $24,%rsp
fldt 32(%rsp)
fnstcw 14(%rsp)
movzwl 14(%rsp),%eax
andb $-13,%ah
orb $8,%ah
movw %ax,12(%rsp)
fldcw 12(%rsp)
// Returns smallest integral not less than 𝑥.
//
// @param 𝑥 is long double passed on stack
// @return long double in %st
ceill: pushq %rbp
mov %rsp,%rbp
.profilable
sub $16,%rsp
fnstcw -2(%rbp)
fldt 16(%rbp)
movzwl -2(%rbp),%eax
and $-13,%ah
or $8,%ah
mov %ax,-4(%rbp)
fldcw -4(%rbp)
frndint
fldcw 14(%rsp)
add $24,%rsp
fldcw -2(%rbp)
leave
ret
.endfn ceill,globl