summaryrefslogtreecommitdiff
path: root/libc/sysdeps/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/x86_64')
-rw-r--r--libc/sysdeps/x86_64/configure124
-rw-r--r--libc/sysdeps/x86_64/dl-tlsdesc.h6
-rw-r--r--libc/sysdeps/x86_64/fpu/libm-test-ulps174
-rw-r--r--libc/sysdeps/x86_64/fpu/s_sincosf.S558
-rw-r--r--libc/sysdeps/x86_64/multiarch/init-arch.c3
-rw-r--r--libc/sysdeps/x86_64/multiarch/init-arch.h9
-rw-r--r--libc/sysdeps/x86_64/multiarch/strncmp-ssse3.S10
7 files changed, 726 insertions, 158 deletions
diff --git a/libc/sysdeps/x86_64/configure b/libc/sysdeps/x86_64/configure
index adbaeee32..0fa0e1ecf 100644
--- a/libc/sysdeps/x86_64/configure
+++ b/libc/sysdeps/x86_64/configure
@@ -1,128 +1,4 @@
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
- return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
- set +e
- as_fn_set_status $1
- exit $1
-} # as_fn_exit
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-
- as_lineno_1=$LINENO as_lineno_1a=$LINENO
- as_lineno_2=$LINENO as_lineno_2a=$LINENO
- eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
- test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
- # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
-
- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
- # already done that, so ensure we don't try to do so again and fall
- # in an infinite loop. This has already happened in practice.
- _as_can_reexec=no; export _as_can_reexec
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-# ac_fn_c_try_compile LINENO
-# --------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- rm -f conftest.$ac_objext
- if { { ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_compile") 2>conftest.err
- ac_status=$?
- if test -s conftest.err; then
- grep -v '^ *+' conftest.err >conftest.er1
- cat conftest.er1 >&5
- mv -f conftest.er1 conftest.err
- fi
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_compile
-
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
diff --git a/libc/sysdeps/x86_64/dl-tlsdesc.h b/libc/sysdeps/x86_64/dl-tlsdesc.h
index 06ede0214..ec750904f 100644
--- a/libc/sysdeps/x86_64/dl-tlsdesc.h
+++ b/libc/sysdeps/x86_64/dl-tlsdesc.h
@@ -20,12 +20,6 @@
#ifndef _X86_64_DL_TLSDESC_H
# define _X86_64_DL_TLSDESC_H 1
-/* Use this to access DT_TLSDESC_PLT and DT_TLSDESC_GOT. */
-#ifndef ADDRIDX
-# define ADDRIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
- + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag))
-#endif
-
/* Type used to represent a TLS descriptor in the GOT. */
struct tlsdesc
{
diff --git a/libc/sysdeps/x86_64/fpu/libm-test-ulps b/libc/sysdeps/x86_64/fpu/libm-test-ulps
index b02b9e6ba..9c5157ff7 100644
--- a/libc/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/libc/sysdeps/x86_64/fpu/libm-test-ulps
@@ -812,6 +812,12 @@ float: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: clog (0x0.ffffffffffffffffp0 + 0x0.ffffffffffffffffp-15000 i) == -5.421010862427522170184200798202494495630e-20 + 3.548665303440282824232502561095699343814e-4516 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -5.960464655174753498633255797994360530379e-8 + 7.888609052210118054117285652827862296732e-31 i":
+float: 1
+ifloat: 1
Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i) == 8.298731898331237038231468223024422855654e-5 + 1.110938609507128729312743251313024793990e-3 i":
float: 1
ifloat: 1
@@ -841,6 +847,9 @@ ldouble: 1
Test "Real part of: clog (0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - 0 i":
ildouble: 1
ldouble: 1
+Test "Imaginary part of: clog (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 5.0844550531823026520677817684239496041087e-32 + 1.2627468605458094918919206628466016525397 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
double: 1
idouble: 1
@@ -868,6 +877,12 @@ ldouble: 1
Test "Real part of: clog (0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
ildouble: 1
ldouble: 1
+Test "Imaginary part of: clog (0x2818p-15 + 0x798fp-15 i) == 1.5366822245016167178749091974664853785194e-08 + 1.2522014929038946066987318471922169174157 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog (0x2dd46725bp-35 + 0x7783a1284p-35 i) == 4.4469229730850767799109418892826021157328e-20 + 1.2046235979300843056806465045930070146351 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: clog (1.0 + 0x1.234566p-10 i) == 6.172834701221959432440126967147726538097e-7 + 1.111110564353742042376451655136933182201e-3 i":
float: 1
ifloat: 1
@@ -1009,6 +1024,21 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: clog10 (0x0.fffffffffffff8p0 + 0x0.fffffffffffff8p-1000 i) == -4.821637332766435821255375046554377090472e-17 + 4.053112396770095089737411317782466262176e-302 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x0.ffffffffffffffffp0 + 0x0.ffffffffffffffffp-15000 i) == -2.354315103889861110220423157644627849164e-20 + 1.541165759405643564697852372112893034397e-4516 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -2.588596909321764128428416045209904492216e-8 + 3.425979381266895667295625489912064603415e-31 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i":
float: 1
ifloat: 1
@@ -1068,6 +1098,29 @@ ldouble: 1
Test "Real part of: clog10 (0x1.fp+16383 - 0x1p-16445 i) == 4932.061660674182269085496060792589701158 - 0 i":
ildouble: 1
ldouble: 1
+Test "Real part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i) == 1.3918041236396763648388478552321724382899e-29 + 0.6263795733790237053262025311642907438291 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x11682p-23 + 0x7ffed1p-23 i) == 5.0916490233953865181284669870035717560498e-13 + 0.6784968969384861816694467029319146542069 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x164c74eea876p-45 + 0x16f393482f77p-45 i) == -1.3155760824064879362415202279780039150764e-26 + 0.3473590599762514228227328130640352044313 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1a6p-10 + 0x3a5p-10 i) == -6.2126412844802358329771948751248003038444e-07 + 0.4977135139537443711784513409096950995985 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1a6p-10 + 0x3a5p-10 i) == -6.2126412844802358329771948751248003038444e-07 + 0.4977135139537443711784513409096950995985 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
double: 1
idouble: 1
@@ -1151,6 +1204,75 @@ ifloat: 1
Test "Real part of: clog10 (0x1p-8190 + 1.0 i) == 2.920285685286322365786846845062520925172e-4932 + 6.821881769209206737428918127156778851051e-1 i":
ildouble: 1
ldouble: 1
+Test "Real part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i) == 1.9312741086596516918394613098872836703188e-20 + 0.5231613813514771042838490538484014771862 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i) == 1.9312741086596516918394613098872836703188e-20 + 0.5231613813514771042838490538484014771862 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i) == -6.4375803621988389731799033530075237868110e-21 + 0.4378257977686804492768642780897650927167 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i) == -6.4375803621988389731799033530075237868110e-21 + 0.4378257977686804492768642780897650927167 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x4d4ep-15 + 0x6605p-15 i) == -7.0781945783414996953799915941870192015212e-09 + 0.4005747524909781155537088181659175147564 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i) == 3.6079845358966994996207055940336690133424e-30 + 0.5243112258263349992771652393178033846555 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x659b70ab7971bp-53 + 0x1f5d111e08abecp-53 i) == -1.0893543813872082317104059174982092534059e-30 + 0.5954257879188711495921161433751775633232 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x659feap-24 + 0xeaf6f9p-24 i) == 1.6200701438094619117335617123525612051457e-14 + 0.5049027913635038013499728086604870749732 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x6b10b4f3520217b6p-64 + 0xe8893cbb449253a1p-64 i) == 1.0529283395205396881397407610630442563938e-37 + 0.4947949395762683446121140513971996916447 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x81b7efa81fc35ad1p-65 + 0x1ef4b835f1c79d812p-65 i) == -4.3074341162203896332989394770760901408798e-39 + 0.5709443672155660428417571212549720987784 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x8ecbf810c4ae6p-52 + 0xd479468b09a37p-52 i) == -4.2289432987513243393180377141513840878196e-30 + 0.4252020027092323591068799049905597805296 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x9b57bp-20 + 0xcb7b4p-20 i) == -1.7182001068739620267773842120965071561416e-11 + 0.3990121149225253562859800593935899629087 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i) == 2.3329549194675052736016290082882121135546e-26 + 0.4561756099441139182878993697611751382976 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i) == 2.680828048441605163181684680300513080769e-7 + 4.825491868832381486767558728169977751564e-4 i":
double: 1
idouble: 1
@@ -1611,9 +1733,14 @@ ldouble: 1
Test "Imaginary part of: ctan (0x1p1023 + 1 i) == -0.2254627924997545057926782581695274244229 + 0.8786063118883068695462540226219865087189 i":
ildouble: 1
ldouble: 1
+Test "Real part of: ctan (0x1p127 + 1 i) == 0.2446359391192790896381501310437708987204 + 0.9101334047676183761532873794426475906201 i":
+float: 1
+ifloat: 1
Test "Imaginary part of: ctan (0x1p127 + 1 i) == 0.2446359391192790896381501310437708987204 + 0.9101334047676183761532873794426475906201 i":
double: 1
+float: 2
idouble: 1
+ifloat: 2
Test "Real part of: ctan (0x3.243f6cp-1 + 0 i) == -2.287733242885645987394874673945769518150e7 + 0.0 i":
float: 1
ifloat: 1
@@ -1758,7 +1885,12 @@ ildouble: 1
ldouble: 1
Test "Real part of: ctanh (1 + 0x1p127 i) == 0.9101334047676183761532873794426475906201 + 0.2446359391192790896381501310437708987204 i":
double: 1
+float: 2
idouble: 1
+ifloat: 2
+Test "Imaginary part of: ctanh (1 + 0x1p127 i) == 0.9101334047676183761532873794426475906201 + 0.2446359391192790896381501310437708987204 i":
+float: 1
+ifloat: 1
Test "Imaginary part of: ctanh (45 + 1 i) == 1.000000000000000000000000000000000000001 + 1.490158918874345552942703234806348520895e-39 i":
ildouble: 1
ldouble: 1
@@ -2399,8 +2531,8 @@ ifloat: 2
ildouble: 1
ldouble: 1
Test "sin_upward (3) == 0.1411200080598672221007448028081102798469":
-float: 1
-ifloat: 1
+float: 2
+ifloat: 2
ildouble: 1
ldouble: 1
Test "sin_upward (4) == -0.7568024953079282513726390945118290941359":
@@ -2430,12 +2562,6 @@ ifloat: 1
Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.69534156199418473 in cos_res":
double: 1
idouble: 1
-Test "sincos (0x1p+120, &sin_res, &cos_res) puts -9.25879022854837867303861764107414946730833e-01 in cos_res":
-float: 1
-ifloat: 1
-Test "sincos (0x1p+127, &sin_res, &cos_res) puts 7.81914638714960072263910298466369236613162e-01 in cos_res":
-float: 1
-ifloat: 1
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
float: 1
@@ -2706,7 +2832,9 @@ ildouble: 2
ldouble: 2
Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16":
double: 1
+float: 1
idouble: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "y1 (1.5) == -0.412308626973911295952829820633445323":
@@ -3041,20 +3169,22 @@ ldouble: 1
Function: Imaginary part of "clog":
float: 3
ifloat: 3
+ildouble: 1
+ldouble: 1
Function: Real part of "clog10":
double: 2
-float: 1
+float: 2
idouble: 2
-ifloat: 1
+ifloat: 2
ildouble: 1
ldouble: 1
Function: Imaginary part of "clog10":
double: 1
-float: 5
+float: 1
idouble: 1
-ifloat: 5
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -3085,8 +3215,8 @@ ildouble: 1
ldouble: 1
Function: "cos_upward":
-float: 1
-ifloat: 1
+float: 2
+ifloat: 2
ildouble: 1
ldouble: 1
@@ -3174,17 +3304,17 @@ ldouble: 1
Function: Real part of "ctan":
double: 1
-float: 1
+float: 2
idouble: 1
-ifloat: 1
+ifloat: 2
ildouble: 2
ldouble: 2
Function: Imaginary part of "ctan":
double: 1
-float: 1
+float: 2
idouble: 1
-ifloat: 1
+ifloat: 2
ildouble: 1
ldouble: 1
@@ -3242,9 +3372,9 @@ ldouble: 4
Function: Real part of "ctanh":
double: 1
-float: 1
+float: 2
idouble: 1
-ifloat: 1
+ifloat: 2
ildouble: 1
ldouble: 1
@@ -3445,8 +3575,8 @@ ildouble: 1
ldouble: 1
Function: "sin_upward":
-float: 1
-ifloat: 1
+float: 2
+ifloat: 2
ildouble: 1
ldouble: 1
diff --git a/libc/sysdeps/x86_64/fpu/s_sincosf.S b/libc/sysdeps/x86_64/fpu/s_sincosf.S
new file mode 100644
index 000000000..3334a3a78
--- /dev/null
+++ b/libc/sysdeps/x86_64/fpu/s_sincosf.S
@@ -0,0 +1,558 @@
+/* Optimized sincosf function.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#define __need_Emath
+#include <bits/errno.h>
+
+/* Short algorithm description:
+ *
+ * 1) if |x|==0: sin(x)=x,
+ * cos(x)=1.
+ * 2) if |x|<2^-27: sin(x)=x-x*DP_SMALL, raising underflow only when needed,
+ * cos(x)=1-|x|.
+ * 3) if |x|<2^-5 : sin(x)=x+x*x^2*DP_SIN2_0+x^5*DP_SIN2_1,
+ * cos(x)=1+1*x^2*DP_COS2_0+x^5*DP_COS2_1
+ * 4) if |x|< Pi/4: sin(x)=x+x*x^2*(S0+x^2*(S1+x^2*(S2+x^2*(S3+x^2*S4)))),
+ * cos(x)=1+1*x^2*(C0+x^2*(C1+x^2*(C2+x^2*(C3+x^2*C4)))).
+ * 5) if |x| < 9*Pi/4:
+ * 5.1) Range reduction:
+ * k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+1, t=|x|-j*Pi/4.
+ * 5.2) Reconstruction:
+ * sign_sin = sign(x) * (-1.0)^(( n >>2)&1)
+ * sign_cos = (-1.0)^(((n+2)>>2)&1)
+ * poly_sin = ((((S4*t^2 + S3)*t^2 + S2)*t^2 + S1)*t^2 + S0)*t^2*t+t
+ * poly_cos = ((((C4*t^2 + C3)*t^2 + C2)*t^2 + C1)*t^2 + C0)*t^2*s+s
+ * if(n&2 != 0) {
+ * using cos(t) and sin(t) polynomials for |t|<Pi/4, results are
+ * cos(x) = poly_sin * sign_cos
+ * sin(x) = poly_cos * sign_sin
+ * } else {
+ * sin(x) = poly_sin * sign_sin
+ * cos(x) = poly_cos * sign_cos
+ * }
+ * 6) if |x| < 2^23, large args:
+ * 6.1) Range reduction:
+ * k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+1, t=|x|-j*Pi/4
+ * 6.2) Reconstruction same as (5.2).
+ * 7) if |x| >= 2^23, very large args:
+ * 7.1) Range reduction:
+ * k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+1, t=|x|-j*Pi/4.
+ * 7.2) Reconstruction same as (5.2).
+ * 8) if x is Inf, return x-x, and set errno=EDOM.
+ * 9) if x is NaN, return x-x.
+ *
+ * Special cases:
+ * sin/cos(+-0) = +-0/1 not raising inexact/underflow,
+ * sin/cos(subnormal) raises inexact/underflow,
+ * sin/cos(min_normalized) raises inexact/underflow,
+ * sin/cos(normalized) raises inexact,
+ * sin/cos(Inf) = NaN, raises invalid, sets errno to EDOM,
+ * sin/cos(NaN) = NaN.
+ */
+
+# define ARG_SIN_PTR %rdi
+# define ARG_COS_PTR %rsi
+
+ .text
+ENTRY(__sincosf)
+ /* Input: %xmm0 contains single precision argument x */
+ /* %rdi points to sin result */
+ /* %rsi points to cos result */
+
+ movd %xmm0, %eax /* Bits of x */
+ movaps %xmm0, %xmm7 /* Copy of x */
+ cvtss2sd %xmm0, %xmm0 /* DP x */
+ movss L(SP_ABS_MASK)(%rip), %xmm3
+ movl %eax, %r8d /* Copy of x bits */
+ andl $0x7fffffff, %eax /* |x| */
+
+ cmpl $0x3f490fdb, %eax /* |x|<Pi/4 ? */
+ jb L(arg_less_pio4)
+
+ /* Here if |x|>=Pi/4 */
+ andps %xmm7, %xmm3 /* SP |x| */
+ andpd L(DP_ABS_MASK)(%rip),%xmm0 /* DP |x| */
+ movss L(SP_INVPIO4)(%rip), %xmm2 /* SP 1/(Pi/4) */
+
+ cmpl $0x40e231d6, %eax /* |x|<9*Pi/4 ? */
+ jae L(large_args)
+
+ /* Here if Pi/4<=|x|<9*Pi/4 */
+ mulss %xmm3, %xmm2 /* SP |x|/(Pi/4) */
+ movl %r8d, %ecx /* Load x */
+ cvttss2si %xmm2, %eax /* k, number of Pi/4 in x */
+ lea L(PIO4J)(%rip), %r9
+ shrl $29, %ecx /* (sign of x) << 2 */
+ addl $1, %eax /* k+1 */
+ movl $0x0e, %edx
+ andl %eax, %edx /* j = (k+1)&0x0e */
+ subsd (%r9,%rdx,8), %xmm0 /* t = |x| - j * Pi/4 */
+
+L(reconstruction):
+ /* Input: %eax=n, %xmm0=t, %ecx=sign(x) */
+
+ movaps %xmm0, %xmm4 /* t */
+ movhpd L(DP_ONES)(%rip), %xmm4 /* 1|t */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ movl $2, %edx
+ unpcklpd %xmm0, %xmm0 /* y|y */
+ addl %eax, %edx /* k+2 */
+ movaps %xmm0, %xmm1 /* y|y */
+ mulpd %xmm0, %xmm0 /* z=t^4|z=t^4 */
+
+ movaps L(DP_SC4)(%rip), %xmm2 /* S4 */
+ mulpd %xmm0, %xmm2 /* z*S4 */
+ movaps L(DP_SC3)(%rip), %xmm3 /* S3 */
+ mulpd %xmm0, %xmm3 /* z*S3 */
+ xorl %eax, %ecx /* (sign_x ^ (k>>2))<<2 */
+ addpd L(DP_SC2)(%rip), %xmm2 /* S2+z*S4 */
+ mulpd %xmm0, %xmm2 /* z*(S2+z*S4) */
+ shrl $2, %edx /* (k+2)>>2 */
+ addpd L(DP_SC1)(%rip), %xmm3 /* S1+z*S3 */
+ mulpd %xmm0, %xmm3 /* z*(S1+z*S3) */
+ shrl $2, %ecx /* sign_x ^ k>>2 */
+ addpd L(DP_SC0)(%rip), %xmm2 /* S0+z*(S2+z*S4) */
+ andl $1, %edx /* sign_cos = ((k+2)>>2)&1 */
+ mulpd %xmm1, %xmm2 /* y*(S0+z*(S2+z*S4)) */
+ andl $1, %ecx /* sign_sin = sign_x ^ ((k>>2)&1) */
+ addpd %xmm2, %xmm3 /* y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ lea L(DP_ONES)(%rip), %r9
+ mulpd %xmm4, %xmm3 /*t*y*(S0+y*(S1+y*(S2+y*(S3+y*S4))))*/
+ testl $2, %eax /* n&2 != 0 ? */
+ addpd %xmm4, %xmm3 /*t+t*y*(S0+y*(S1+y*(S2+y*(S3+y*S4))*/
+ jnz L(sin_result_sin_poly)
+
+/*L(sin_result_cos_poly):*/
+ /*
+ * Here if
+ * cos(x) = poly_sin * sign_cos
+ * sin(x) = poly_cos * sign_sin
+ */
+ movsd (%r9,%rcx,8), %xmm4 /* 0|sign_sin */
+ movhpd (%r9,%rdx,8), %xmm4 /* sign_cos|sign_sin */
+ mulpd %xmm4, %xmm3 /* result_cos|result_sin */
+ cvtpd2ps %xmm3, %xmm0 /* SP results */
+ movss %xmm0, (ARG_SIN_PTR) /* store sin(x) from xmm0[0] */
+ shufps $1, %xmm0, %xmm0 /* move cos(x) to xmm0[0] */
+ movss %xmm0, (ARG_COS_PTR) /* store cos(x) */
+ ret
+
+ .p2align 4
+L(sin_result_sin_poly):
+ /*
+ * Here if
+ * sin(x) = poly_sin * sign_sin
+ * cos(x) = poly_cos * sign_cos
+ */
+ movsd (%r9,%rdx,8), %xmm4 /* 0|sign_cos */
+ movhpd (%r9,%rcx,8), %xmm4 /* sign_sin|sign_cos */
+ mulpd %xmm4, %xmm3 /* result_sin|result_cos */
+ cvtpd2ps %xmm3, %xmm0 /* SP results */
+ movss %xmm0, (ARG_COS_PTR) /* store cos(x) from xmm0[0] */
+ shufps $1, %xmm0, %xmm0 /* move sin(x) to xmm0[0] */
+ movss %xmm0, (ARG_SIN_PTR) /* store sin(x) */
+ ret
+
+ .p2align 4
+L(large_args):
+ /* Here if |x|>=9*Pi/4 */
+ cmpl $0x7f800000, %eax /* x is Inf or NaN ? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if finite |x|>=9*Pi/4 */
+ cmpl $0x4b000000, %eax /* |x|<2^23 ? */
+ jae L(very_large_args)
+
+ /* Here if 9*Pi/4<=|x|<2^23 */
+ movsd L(DP_INVPIO4)(%rip), %xmm1 /* 1/(Pi/4) */
+ mulsd %xmm0, %xmm1 /* |x|/(Pi/4) */
+ cvttsd2si %xmm1, %eax /* k=trunc(|x|/(Pi/4)) */
+ addl $1, %eax /* k+1 */
+ movl %eax, %edx
+ andl $0xfffffffe, %edx /* j=(k+1)&0xfffffffe */
+ cvtsi2sdl %edx, %xmm4 /* DP j */
+ movl %r8d, %ecx /* Load x */
+ movsd L(DP_PIO4HI)(%rip), %xmm2 /* -PIO4HI = high part of -Pi/4 */
+ shrl $29, %ecx /* (sign of x) << 2 */
+ mulsd %xmm4, %xmm2 /* -j*PIO4HI */
+ movsd L(DP_PIO4LO)(%rip), %xmm3 /* -PIO4LO = low part of -Pi/4 */
+ addsd %xmm2, %xmm0 /* |x| - j*PIO4HI */
+ mulsd %xmm3, %xmm4 /* j*PIO4LO */
+ addsd %xmm4, %xmm0 /* t = |x| - j*PIO4HI - j*PIO4LO */
+ jmp L(reconstruction)
+
+ .p2align 4
+L(very_large_args):
+ /* Here if finite |x|>=2^23 */
+
+ /* bitpos = (ix>>23) - BIAS_32 + 59; */
+ shrl $23, %eax /* eb = biased exponent of x */
+ subl $68, %eax /* bitpos=eb-0x7f+59, where 0x7f */
+ /*is exponent bias */
+ movl $28, %ecx /* %cl=28 */
+ movl %eax, %edx /* bitpos copy */
+
+ /* j = bitpos/28; */
+ div %cl /* j in register %al=%ax/%cl */
+ movapd %xmm0, %xmm3 /* |x| */
+ andl $0xff, %eax /* clear unneeded remainder from %ah*/
+
+ imull $28, %eax, %ecx /* j*28 */
+ lea L(_FPI)(%rip), %r9
+ movsd L(DP_HI_MASK)(%rip), %xmm4 /* DP_HI_MASK */
+ movapd %xmm0, %xmm5 /* |x| */
+ mulsd -16(%r9,%rax,8), %xmm3 /* tmp3 = FPI[j-2]*|x| */
+ movapd %xmm0, %xmm1 /* |x| */
+ mulsd -8(%r9,%rax,8), %xmm5 /* tmp2 = FPI[j-1]*|x| */
+ mulsd (%r9,%rax,8), %xmm0 /* tmp0 = FPI[j]*|x| */
+ addl $19, %ecx /* j*28+19 */
+ mulsd 8(%r9,%rax,8), %xmm1 /* tmp1 = FPI[j+1]*|x| */
+ cmpl %ecx, %edx /* bitpos>=j*28+19 ? */
+ jl L(very_large_skip1)
+
+ /* Here if bitpos>=j*28+19 */
+ andpd %xmm3, %xmm4 /* HI(tmp3) */
+ subsd %xmm4, %xmm3 /* tmp3 = tmp3 - HI(tmp3) */
+L(very_large_skip1):
+
+ movsd L(DP_2POW52)(%rip), %xmm6
+ movapd %xmm5, %xmm2 /* tmp2 copy */
+ addsd %xmm3, %xmm5 /* tmp5 = tmp3 + tmp2 */
+ movl $1, %edx
+ addsd %xmm5, %xmm6 /* tmp6 = tmp5 + 2^52 */
+ movsd 8+L(DP_2POW52)(%rip), %xmm4
+ movd %xmm6, %eax /* k = I64_LO(tmp6); */
+ addsd %xmm6, %xmm4 /* tmp4 = tmp6 - 2^52 */
+ movl %r8d, %ecx /* Load x */
+ comisd %xmm5, %xmm4 /* tmp4 > tmp5 ? */
+ jbe L(very_large_skip2)
+
+ /* Here if tmp4 > tmp5 */
+ subl $1, %eax /* k-- */
+ addsd 8+L(DP_ONES)(%rip), %xmm4 /* tmp4 -= 1.0 */
+L(very_large_skip2):
+
+ andl %eax, %edx /* k&1 */
+ lea L(DP_ZERONE)(%rip), %r9
+ subsd %xmm4, %xmm3 /* tmp3 -= tmp4 */
+ addsd (%r9,%rdx,8), %xmm3 /* t = DP_ZERONE[k&1] + tmp3 */
+ addsd %xmm2, %xmm3 /* t += tmp2 */
+ shrl $29, %ecx /* (sign of x) << 2 */
+ addsd %xmm3, %xmm0 /* t += tmp0 */
+ addl $1, %eax /* n=k+1 */
+ addsd %xmm1, %xmm0 /* t += tmp1 */
+ mulsd L(DP_PIO4)(%rip), %xmm0 /* t *= PI04 */
+
+ jmp L(reconstruction) /* end of very_large_args peth */
+
+ .p2align 4
+L(arg_less_pio4):
+ /* Here if |x|<Pi/4 */
+ cmpl $0x3d000000, %eax /* |x|<2^-5 ? */
+ jl L(arg_less_2pn5)
+
+ /* Here if 2^-5<=|x|<Pi/4 */
+ movaps %xmm0, %xmm3 /* DP x */
+ movhpd L(DP_ONES)(%rip), %xmm3 /* DP 1|x */
+ mulsd %xmm0, %xmm0 /* DP y=x^2 */
+ unpcklpd %xmm0, %xmm0 /* DP y|y */
+ movaps %xmm0, %xmm1 /* y|y */
+ mulpd %xmm0, %xmm0 /* z=x^4|z=x^4 */
+
+ movapd L(DP_SC4)(%rip), %xmm4 /* S4 */
+ mulpd %xmm0, %xmm4 /* z*S4 */
+ movapd L(DP_SC3)(%rip), %xmm5 /* S3 */
+ mulpd %xmm0, %xmm5 /* z*S3 */
+ addpd L(DP_SC2)(%rip), %xmm4 /* S2+z*S4 */
+ mulpd %xmm0, %xmm4 /* z*(S2+z*S4) */
+ addpd L(DP_SC1)(%rip), %xmm5 /* S1+z*S3 */
+ mulpd %xmm0, %xmm5 /* z*(S1+z*S3) */
+ addpd L(DP_SC0)(%rip), %xmm4 /* S0+z*(S2+z*S4) */
+ mulpd %xmm1, %xmm4 /* y*(S0+z*(S2+z*S4)) */
+ mulpd %xmm3, %xmm5 /* x*z*(S1+z*S3) */
+ mulpd %xmm3, %xmm4 /* x*y*(S0+z*(S2+z*S4)) */
+ addpd %xmm5, %xmm4 /*x*y*(S0+y*(S1+y*(S2+y*(S3+y*S4))))*/
+ addpd %xmm4, %xmm3 /*x+x*y*(S0+y*(S1+y*(S2+y*(S3+y*S4))*/
+ cvtpd2ps %xmm3, %xmm0 /* SP results */
+ movss %xmm0, (ARG_SIN_PTR) /* store sin(x) from xmm0[0] */
+ shufps $1, %xmm0, %xmm0 /* move cos(x) to xmm0[0] */
+ movss %xmm0, (ARG_COS_PTR) /* store cos(x) */
+ ret
+
+ .p2align 4
+L(arg_less_2pn5):
+ /* Here if |x|<2^-5 */
+ cmpl $0x32000000, %eax /* |x|<2^-27 ? */
+ jl L(arg_less_2pn27)
+
+ /* Here if 2^-27<=|x|<2^-5 */
+ movaps %xmm0, %xmm1 /* DP x */
+ movhpd L(DP_ONES)(%rip), %xmm1 /* DP 1|x */
+ mulsd %xmm0, %xmm0 /* DP x^2 */
+ unpcklpd %xmm0, %xmm0 /* DP x^2|x^2 */
+
+ movaps L(DP_SINCOS2_1)(%rip), %xmm3 /* DP DP_SIN2_1 */
+ mulpd %xmm0, %xmm3 /* DP x^2*DP_SIN2_1 */
+ addpd L(DP_SINCOS2_0)(%rip), %xmm3 /* DP DP_SIN2_0+x^2*DP_SIN2_1 */
+ mulpd %xmm0, %xmm3 /* DP x^2*DP_SIN2_0+x^4*DP_SIN2_1 */
+ mulpd %xmm1, %xmm3 /* DP x^3*DP_SIN2_0+x^5*DP_SIN2_1 */
+ addpd %xmm1, %xmm3 /* DP x+x^3*DP_SIN2_0+x^5*DP_SIN2_1 */
+ cvtpd2ps %xmm3, %xmm0 /* SP results */
+ movss %xmm0, (ARG_SIN_PTR) /* store sin(x) from xmm0[0] */
+ shufps $1, %xmm0, %xmm0 /* move cos(x) to xmm0[0] */
+ movss %xmm0, (ARG_COS_PTR) /* store cos(x) */
+ ret
+
+ .p2align 4
+L(arg_less_2pn27):
+ cmpl $0, %eax /* x=0 ? */
+ je L(arg_zero) /* in case x=0 return sin(+-0)==+-0 */
+ /* Here if |x|<2^-27 */
+ /*
+ * Special cases here:
+ * sin(subnormal) raises inexact/underflow
+ * sin(min_normalized) raises inexact/underflow
+ * sin(normalized) raises inexact
+ * cos(here)=1-|x| (raising inexact)
+ */
+ movaps %xmm0, %xmm3 /* DP x */
+ mulsd L(DP_SMALL)(%rip), %xmm0/* DP x*DP_SMALL */
+ subsd %xmm0, %xmm3 /* DP sin result is x-x*DP_SMALL */
+ andps L(SP_ABS_MASK)(%rip), %xmm7/* SP |x| */
+ cvtsd2ss %xmm3, %xmm0 /* sin(x) */
+ movss L(SP_ONE)(%rip), %xmm1 /* SP 1.0 */
+ movss %xmm0, (ARG_SIN_PTR) /* sin(x) store */
+ subss %xmm7, %xmm1 /* cos(x) */
+ movss %xmm1, (ARG_COS_PTR) /* cos(x) store */
+ ret
+
+ .p2align 4
+L(arg_zero):
+ movss L(SP_ONE)(%rip), %xmm0 /* 1.0 */
+ movss %xmm7, (ARG_SIN_PTR) /* sin(+-0)==x */
+ movss %xmm0, (ARG_COS_PTR) /* cos(+-0)==1 */
+ ret
+
+ .p2align 4
+L(arg_inf_or_nan):
+ /* Here if |x| is Inf or NAN */
+ jne L(skip_errno_setting) /* in case of x is NaN */
+
+ /* Here if x is Inf. Set errno to EDOM. */
+ call JUMPTARGET(__errno_location)
+ movl $EDOM, (%rax)
+
+ .p2align 4
+L(skip_errno_setting):
+ /* Here if |x| is Inf or NAN. Continued. */
+ subss %xmm7, %xmm7 /* x-x, result is NaN */
+ movss %xmm7, (ARG_SIN_PTR)
+ movss %xmm7, (ARG_COS_PTR)
+ ret
+END(__sincosf)
+
+ .section .rodata, "a"
+ .p2align 3
+L(PIO4J): /* Table of j*Pi/4, for j=0,1,..,10 */
+ .long 0x00000000,0x00000000
+ .long 0x54442d18,0x3fe921fb
+ .long 0x54442d18,0x3ff921fb
+ .long 0x7f3321d2,0x4002d97c
+ .long 0x54442d18,0x400921fb
+ .long 0x2955385e,0x400f6a7a
+ .long 0x7f3321d2,0x4012d97c
+ .long 0xe9bba775,0x4015fdbb
+ .long 0x54442d18,0x401921fb
+ .long 0xbeccb2bb,0x401c463a
+ .long 0x2955385e,0x401f6a7a
+ .type L(PIO4J), @object
+ ASM_SIZE_DIRECTIVE(L(PIO4J))
+
+ .p2align 3
+L(_FPI): /* 4/Pi broken into sum of positive DP values */
+ .long 0x00000000,0x00000000
+ .long 0x6c000000,0x3ff45f30
+ .long 0x2a000000,0x3e3c9c88
+ .long 0xa8000000,0x3c54fe13
+ .long 0xd0000000,0x3aaf47d4
+ .long 0x6c000000,0x38fbb81b
+ .long 0xe0000000,0x3714acc9
+ .long 0x7c000000,0x3560e410
+ .long 0x56000000,0x33bca2c7
+ .long 0xac000000,0x31fbd778
+ .long 0xe0000000,0x300b7246
+ .long 0xe8000000,0x2e5d2126
+ .long 0x48000000,0x2c970032
+ .long 0xe8000000,0x2ad77504
+ .long 0xe0000000,0x290921cf
+ .long 0xb0000000,0x274deb1c
+ .long 0xe0000000,0x25829a73
+ .long 0xbe000000,0x23fd1046
+ .long 0x10000000,0x2224baed
+ .long 0x8e000000,0x20709d33
+ .long 0x80000000,0x1e535a2f
+ .long 0x64000000,0x1cef904e
+ .long 0x30000000,0x1b0d6398
+ .long 0x24000000,0x1964ce7d
+ .long 0x16000000,0x17b908bf
+ .type L(_FPI), @object
+ ASM_SIZE_DIRECTIVE(L(_FPI))
+
+/* Coefficients of polynomials for */
+/* sin(x)~=x+x*x^2*(DP_SIN2_0+x^2*DP_SIN2_1) in low DP part, */
+/* cos(x)~=1+1*x^2*(DP_COS2_0+x^2*DP_COS2_1) in high DP part, */
+/* for |x|<2^-5. */
+ .p2align 4
+L(DP_SINCOS2_0):
+ .long 0x5543d49d,0xbfc55555
+ .long 0xff5cc6fd,0xbfdfffff
+ .type L(DP_SINCOS2_0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SINCOS2_0))
+
+ .p2align 4
+L(DP_SINCOS2_1):
+ .long 0x75cec8c5,0x3f8110f4
+ .long 0xb178dac5,0x3fa55514
+ .type L(DP_SINCOS2_1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SINCOS2_1))
+
+
+ .p2align 3
+L(DP_ZERONE):
+ .long 0x00000000,0x00000000 /* 0.0 */
+ .long 0x00000000,0xbff00000 /* 1.0 */
+ .type L(DP_ZERONE), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ZERONE))
+
+ .p2align 3
+L(DP_ONES):
+ .long 0x00000000,0x3ff00000 /* +1.0 */
+ .long 0x00000000,0xbff00000 /* -1.0 */
+ .type L(DP_ONES), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ONES))
+
+/* Coefficients of polynomials for */
+/* sin(t)~=t+t*t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))) in low DP part, */
+/* cos(t)~=1+1*t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))) in high DP part, */
+/* for |t|<Pi/4. */
+ .p2align 4
+L(DP_SC4):
+ .long 0x1674b58a,0xbe5a947e
+ .long 0xdd8844d7,0xbe923c97
+ .type L(DP_SC4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SC4))
+
+ .p2align 4
+L(DP_SC3):
+ .long 0x64e6b5b4,0x3ec71d72
+ .long 0x9ac43cc0,0x3efa00eb
+ .type L(DP_SC3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SC3))
+
+ .p2align 4
+L(DP_SC2):
+ .long 0x8b4bd1f9,0xbf2a019f
+ .long 0x348b6874,0xbf56c16b
+ .type L(DP_SC2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SC2))
+
+ .p2align 4
+L(DP_SC1):
+ .long 0x10c2688b,0x3f811111
+ .long 0x545c50c7,0x3fa55555
+ .type L(DP_SC1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SC1))
+
+ .p2align 4
+L(DP_SC0):
+ .long 0x55551cd9,0xbfc55555
+ .long 0xfffe98ae,0xbfdfffff
+ .type L(DP_SC0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SC0))
+
+ .p2align 3
+L(DP_SMALL):
+ .long 0x00000000,0x3cd00000 /* 2^(-50) */
+ .type L(DP_SMALL), @object
+ ASM_SIZE_DIRECTIVE(L(DP_SMALL))
+
+ .p2align 3
+L(DP_PIO4):
+ .long 0x54442d18,0x3fe921fb /* Pi/4 */
+ .type L(DP_PIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4))
+
+ .p2align 3
+L(DP_2POW52):
+ .long 0x00000000,0x43300000 /* +2^52 */
+ .long 0x00000000,0xc3300000 /* -2^52 */
+ .type L(DP_2POW52), @object
+ ASM_SIZE_DIRECTIVE(L(DP_2POW52))
+
+ .p2align 3
+L(DP_INVPIO4):
+ .long 0x6dc9c883,0x3ff45f30 /* 4/Pi */
+ .type L(DP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(DP_INVPIO4))
+
+ .p2align 3
+L(DP_PIO4HI):
+ .long 0x54000000,0xbfe921fb /* High part of Pi/4 */
+ .type L(DP_PIO4HI), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4HI))
+
+ .p2align 3
+L(DP_PIO4LO):
+ .long 0x11A62633,0xbe010b46 /* Low part of Pi/4 */
+ .type L(DP_PIO4LO), @object
+ ASM_SIZE_DIRECTIVE(L(DP_PIO4LO))
+
+ .p2align 2
+L(SP_INVPIO4):
+ .long 0x3fa2f983 /* 4/Pi */
+ .type L(SP_INVPIO4), @object
+ ASM_SIZE_DIRECTIVE(L(SP_INVPIO4))
+
+ .p2align 4
+L(DP_ABS_MASK): /* Mask for getting DP absolute value */
+ .long 0xffffffff,0x7fffffff
+ .long 0xffffffff,0x7fffffff
+ .type L(DP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_ABS_MASK))
+
+ .p2align 3
+L(DP_HI_MASK): /* Mask for getting high 21 bits of DP value */
+ .long 0x00000000,0xffffffff
+ .type L(DP_HI_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(DP_HI_MASK))
+
+ .p2align 4
+L(SP_ABS_MASK): /* Mask for getting SP absolute value */
+ .long 0x7fffffff,0x7fffffff
+ .long 0x7fffffff,0x7fffffff
+ .type L(SP_ABS_MASK), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ABS_MASK))
+
+ .p2align 2
+L(SP_ONE):
+ .long 0x3f800000 /* 1.0 */
+ .type L(SP_ONE), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ONE))
+
+weak_alias(__sincosf, sincosf)
diff --git a/libc/sysdeps/x86_64/multiarch/init-arch.c b/libc/sysdeps/x86_64/multiarch/init-arch.c
index fb44dcfcf..fed5ab898 100644
--- a/libc/sysdeps/x86_64/multiarch/init-arch.c
+++ b/libc/sysdeps/x86_64/multiarch/init-arch.c
@@ -156,6 +156,9 @@ __init_cpu_features (void)
/* Determine if AVX is usable. */
if (CPUID_AVX)
__cpu_features.feature[index_AVX_Usable] |= bit_AVX_Usable;
+ /* Determine if FMA is usable. */
+ if (CPUID_FMA)
+ __cpu_features.feature[index_FMA_Usable] |= bit_FMA_Usable;
/* Determine if FMA4 is usable. */
if (CPUID_FMA4)
__cpu_features.feature[index_FMA4_Usable] |= bit_FMA4_Usable;
diff --git a/libc/sysdeps/x86_64/multiarch/init-arch.h b/libc/sysdeps/x86_64/multiarch/init-arch.h
index 45e265167..f33f1c81e 100644
--- a/libc/sysdeps/x86_64/multiarch/init-arch.h
+++ b/libc/sysdeps/x86_64/multiarch/init-arch.h
@@ -22,7 +22,8 @@
#define bit_Fast_Unaligned_Load (1 << 4)
#define bit_Prefer_PMINUB_for_stringop (1 << 5)
#define bit_AVX_Usable (1 << 6)
-#define bit_FMA4_Usable (1 << 7)
+#define bit_FMA_Usable (1 << 7)
+#define bit_FMA4_Usable (1 << 8)
/* CPUID Feature flags. */
#define bit_SSE2 (1 << 26)
@@ -56,6 +57,7 @@
# define index_Fast_Unaligned_Load FEATURE_INDEX_1*FEATURE_SIZE
# define index_Prefer_PMINUB_for_stringop FEATURE_INDEX_1*FEATURE_SIZE
# define index_AVX_Usable FEATURE_INDEX_1*FEATURE_SIZE
+# define index_FMA_Usable FEATURE_INDEX_1*FEATURE_SIZE
# define index_FMA4_Usable FEATURE_INDEX_1*FEATURE_SIZE
#else /* __ASSEMBLER__ */
@@ -131,6 +133,8 @@ extern const struct cpu_features *__get_cpu_features (void)
HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_OSXSAVE)
# define CPUID_AVX \
HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_AVX)
+# define CPUID_FMA \
+ HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_FMA)
# define CPUID_FMA4 \
HAS_CPUID_FLAG (COMMON_CPUID_INDEX_80000001, ecx, bit_FMA4)
@@ -140,7 +144,6 @@ extern const struct cpu_features *__get_cpu_features (void)
# define HAS_SSSE3 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSSE3)
# define HAS_SSE4_1 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_1)
# define HAS_SSE4_2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_2)
-# define HAS_FMA HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_FMA)
# define index_Fast_Rep_String FEATURE_INDEX_1
# define index_Fast_Copy_Backward FEATURE_INDEX_1
@@ -148,6 +151,7 @@ extern const struct cpu_features *__get_cpu_features (void)
# define index_Prefer_SSE_for_memop FEATURE_INDEX_1
# define index_Fast_Unaligned_Load FEATURE_INDEX_1
# define index_AVX_Usable FEATURE_INDEX_1
+# define index_FMA_Usable FEATURE_INDEX_1
# define index_FMA4_Usable FEATURE_INDEX_1
# define HAS_ARCH_FEATURE(name) \
@@ -159,6 +163,7 @@ extern const struct cpu_features *__get_cpu_features (void)
# define HAS_PREFER_SSE_FOR_MEMOP HAS_ARCH_FEATURE (Prefer_SSE_for_memop)
# define HAS_FAST_UNALIGNED_LOAD HAS_ARCH_FEATURE (Fast_Unaligned_Load)
# define HAS_AVX HAS_ARCH_FEATURE (AVX_Usable)
+# define HAS_FMA HAS_ARCH_FEATURE (FMA_Usable)
# define HAS_FMA4 HAS_ARCH_FEATURE (FMA4_Usable)
#endif /* __ASSEMBLER__ */
diff --git a/libc/sysdeps/x86_64/multiarch/strncmp-ssse3.S b/libc/sysdeps/x86_64/multiarch/strncmp-ssse3.S
index a320a3e94..96380a46b 100644
--- a/libc/sysdeps/x86_64/multiarch/strncmp-ssse3.S
+++ b/libc/sysdeps/x86_64/multiarch/strncmp-ssse3.S
@@ -1,4 +1,6 @@
-#define USE_SSSE3 1
-#define STRCMP __strncmp_ssse3
-#define USE_AS_STRNCMP
-#include "../strcmp.S"
+#ifdef SHARED
+# define USE_SSSE3 1
+# define STRCMP __strncmp_ssse3
+# define USE_AS_STRNCMP
+# include "../strcmp.S"
+#endif