glibc/sysdeps/x86_64/fpu/e_log2l.S
Siddhesh Poyarekar 30891f35fa Remove "Contributed by" lines
We stopped adding "Contributed by" or similar lines in sources in 2012
in favour of git logs and keeping the Contributors section of the
glibc manual up to date.  Removing these lines makes the license
header a bit more consistent across files and also removes the
possibility of error in attribution when license blocks or files are
copied across since the contributed-by lines don't actually reflect
reality in those cases.

Move all "Contributed by" and similar lines (Written by, Test by,
etc.) into a new file CONTRIBUTED-BY to retain record of these
contributions.  These contributors are also mentioned in
manual/contrib.texi, so we just maintain this additional record as a
courtesy to the earlier developers.

The following scripts were used to filter a list of files to edit in
place and to clean up the CONTRIBUTED-BY file respectively.  These
were not added to the glibc sources because they're not expected to be
of any use in future given that this is a one time task:

https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc
https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-09-03 22:06:44 +05:30

90 lines
1.6 KiB
ArmAsm

/*
* Public domain.
*
*/
#include <machine/asm.h>
#include <libm-alias-finite.h>
.section .rodata.cst8,"aM",@progbits,8
.p2align 3
.type one,@object
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
.type limit,@object
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
# define MO(op) op##(%rip)
#else
# define MO(op) op
#endif
.text
ENTRY(__ieee754_log2l)
fldl MO(one)
fldt 8(%rsp) // x : 1
fxam
fnstsw
fld %st // x : x : 1
testb $1, %ah
jnz 3f // in case x is NaN or ±Inf
4: fsub %st(2), %st // x-1 : x : 1
fld %st // x-1 : x-1 : x : 1
fabs // |x-1| : x-1 : x : 1
fcompl MO(limit) // x-1 : x : 1
fnstsw // x-1 : x : 1
andb $0x45, %ah
jz 2f
fxam
fnstsw
andb $0x45, %ah
cmpb $0x40, %ah
jne 5f
fabs // log2(1) is +0 in all rounding modes.
5: fstp %st(1) // x-1 : 1
fyl2xp1 // log(x)
ret
2: fstp %st(0) // x : 1
fyl2x // log(x)
ret
3: testb $4, %ah
jnz 4b // in case x is ±Inf
fstp %st(1)
fstp %st(1)
fadd %st(0)
ret
END (__ieee754_log2l)
ENTRY(__log2l_finite)
fldl MO(one)
fldt 8(%rsp) // x : 1
fld %st // x : x : 1
fsub %st(2), %st // x-1 : x : 1
fld %st // x-1 : x-1 : x : 1
fabs // |x-1| : x-1 : x : 1
fcompl MO(limit) // x-1 : x : 1
fnstsw // x-1 : x : 1
andb $0x45, %ah
jz 2b
fxam
fnstsw
andb $0x45, %ah
cmpb $0x40, %ah
jne 6f
fabs // log2(1) is +0 in all rounding modes.
6: fstp %st(1) // x-1 : 1
fyl2xp1 // log(x)
ret
END (__log2l_finite)
libm_alias_finite (__log2l_finite, __log2l)