| author | |
| committer | |
| log | 814b1e9a5835902f143bafbb98c7cdf56f1d1f19 |
| tree | 3f3db27693a5704bde8688b087e9e296555cdcb9 |
| parent | bffd5c51125ffd5d859825a038bd18e02682ad49 |
These symbols are already provided by compiler_rt5 files changed, 0 insertions(+), 244 deletions(-)
lib/libc/musl/src/math/fmod.c deleted-68| ... | @@ -1,68 +0,0 @@ | ||
| 1 | #include <math.h> | ||
| 2 | #include <stdint.h> | ||
| 3 | |||
| 4 | double fmod(double x, double y) | ||
| 5 | { | ||
| 6 | 	union {double f; uint64_t i;} ux = {x}, uy = {y}; | ||
| 7 | 	int ex = ux.i>>52 & 0x7ff; | ||
| 8 | 	int ey = uy.i>>52 & 0x7ff; | ||
| 9 | 	int sx = ux.i>>63; | ||
| 10 | 	uint64_t i; | ||
| 11 | |||
| 12 | 	/* in the followings uxi should be ux.i, but then gcc wrongly adds */ | ||
| 13 | 	/* float load/store to inner loops ruining performance and code size */ | ||
| 14 | 	uint64_t uxi = ux.i; | ||
| 15 | |||
| 16 | 	if (uy.i<<1 == 0 || isnan(y) || ex == 0x7ff) | ||
| 17 | 		return (x*y)/(x*y); | ||
| 18 | 	if (uxi<<1 <= uy.i<<1) { | ||
| 19 | 		if (uxi<<1 == uy.i<<1) | ||
| 20 | 			return 0*x; | ||
| 21 | 		return x; | ||
| 22 | 	} | ||
| 23 | |||
| 24 | 	/* normalize x and y */ | ||
| 25 | 	if (!ex) { | ||
| 26 | 		for (i = uxi<<12; i>>63 == 0; ex--, i <<= 1); | ||
| 27 | 		uxi <<= -ex + 1; | ||
| 28 | 	} else { | ||
| 29 | 		uxi &= -1ULL >> 12; | ||
| 30 | 		uxi |= 1ULL << 52; | ||
| 31 | 	} | ||
| 32 | 	if (!ey) { | ||
| 33 | 		for (i = uy.i<<12; i>>63 == 0; ey--, i <<= 1); | ||
| 34 | 		uy.i <<= -ey + 1; | ||
| 35 | 	} else { | ||
| 36 | 		uy.i &= -1ULL >> 12; | ||
| 37 | 		uy.i |= 1ULL << 52; | ||
| 38 | 	} | ||
| 39 | |||
| 40 | 	/* x mod y */ | ||
| 41 | 	for (; ex > ey; ex--) { | ||
| 42 | 		i = uxi - uy.i; | ||
| 43 | 		if (i >> 63 == 0) { | ||
| 44 | 			if (i == 0) | ||
| 45 | 				return 0*x; | ||
| 46 | 			uxi = i; | ||
| 47 | 		} | ||
| 48 | 		uxi <<= 1; | ||
| 49 | 	} | ||
| 50 | 	i = uxi - uy.i; | ||
| 51 | 	if (i >> 63 == 0) { | ||
| 52 | 		if (i == 0) | ||
| 53 | 			return 0*x; | ||
| 54 | 		uxi = i; | ||
| 55 | 	} | ||
| 56 | 	for (; uxi>>52 == 0; uxi <<= 1, ex--); | ||
| 57 | |||
| 58 | 	/* scale result */ | ||
| 59 | 	if (ex > 0) { | ||
| 60 | 		uxi -= 1ULL << 52; | ||
| 61 | 		uxi |= (uint64_t)ex << 52; | ||
| 62 | 	} else { | ||
| 63 | 		uxi >>= -ex + 1; | ||
| 64 | 	} | ||
| 65 | 	uxi |= (uint64_t)sx << 63; | ||
| 66 | 	ux.i = uxi; | ||
| 67 | 	return ux.f; | ||
| 68 | } | ||
lib/libc/musl/src/math/fmodf.c deleted-65| ... | @@ -1,65 +0,0 @@ | ||
| 1 | #include <math.h> | ||
| 2 | #include <stdint.h> | ||
| 3 | |||
| 4 | float fmodf(float x, float y) | ||
| 5 | { | ||
| 6 | 	union {float f; uint32_t i;} ux = {x}, uy = {y}; | ||
| 7 | 	int ex = ux.i>>23 & 0xff; | ||
| 8 | 	int ey = uy.i>>23 & 0xff; | ||
| 9 | 	uint32_t sx = ux.i & 0x80000000; | ||
| 10 | 	uint32_t i; | ||
| 11 | 	uint32_t uxi = ux.i; | ||
| 12 | |||
| 13 | 	if (uy.i<<1 == 0 || isnan(y) || ex == 0xff) | ||
| 14 | 		return (x*y)/(x*y); | ||
| 15 | 	if (uxi<<1 <= uy.i<<1) { | ||
| 16 | 		if (uxi<<1 == uy.i<<1) | ||
| 17 | 			return 0*x; | ||
| 18 | 		return x; | ||
| 19 | 	} | ||
| 20 | |||
| 21 | 	/* normalize x and y */ | ||
| 22 | 	if (!ex) { | ||
| 23 | 		for (i = uxi<<9; i>>31 == 0; ex--, i <<= 1); | ||
| 24 | 		uxi <<= -ex + 1; | ||
| 25 | 	} else { | ||
| 26 | 		uxi &= -1U >> 9; | ||
| 27 | 		uxi |= 1U << 23; | ||
| 28 | 	} | ||
| 29 | 	if (!ey) { | ||
| 30 | 		for (i = uy.i<<9; i>>31 == 0; ey--, i <<= 1); | ||
| 31 | 		uy.i <<= -ey + 1; | ||
| 32 | 	} else { | ||
| 33 | 		uy.i &= -1U >> 9; | ||
| 34 | 		uy.i |= 1U << 23; | ||
| 35 | 	} | ||
| 36 | |||
| 37 | 	/* x mod y */ | ||
| 38 | 	for (; ex > ey; ex--) { | ||
| 39 | 		i = uxi - uy.i; | ||
| 40 | 		if (i >> 31 == 0) { | ||
| 41 | 			if (i == 0) | ||
| 42 | 				return 0*x; | ||
| 43 | 			uxi = i; | ||
| 44 | 		} | ||
| 45 | 		uxi <<= 1; | ||
| 46 | 	} | ||
| 47 | 	i = uxi - uy.i; | ||
| 48 | 	if (i >> 31 == 0) { | ||
| 49 | 		if (i == 0) | ||
| 50 | 			return 0*x; | ||
| 51 | 		uxi = i; | ||
| 52 | 	} | ||
| 53 | 	for (; uxi>>23 == 0; uxi <<= 1, ex--); | ||
| 54 | |||
| 55 | 	/* scale result up */ | ||
| 56 | 	if (ex > 0) { | ||
| 57 | 		uxi -= 1U << 23; | ||
| 58 | 		uxi |= (uint32_t)ex << 23; | ||
| 59 | 	} else { | ||
| 60 | 		uxi >>= -ex + 1; | ||
| 61 | 	} | ||
| 62 | 	uxi |= sx; | ||
| 63 | 	ux.i = uxi; | ||
| 64 | 	return ux.f; | ||
| 65 | } | ||
lib/libc/musl/src/math/fmodl.c deleted-105| ... | @@ -1,105 +0,0 @@ | ||
| 1 | #include "libm.h" | ||
| 2 | |||
| 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 | ||
| 4 | long double fmodl(long double x, long double y) | ||
| 5 | { | ||
| 6 | 	return fmod(x, y); | ||
| 7 | } | ||
| 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 | ||
| 9 | long double fmodl(long double x, long double y) | ||
| 10 | { | ||
| 11 | 	union ldshape ux = {x}, uy = {y}; | ||
| 12 | 	int ex = ux.i.se & 0x7fff; | ||
| 13 | 	int ey = uy.i.se & 0x7fff; | ||
| 14 | 	int sx = ux.i.se & 0x8000; | ||
| 15 | |||
| 16 | 	if (y == 0 || isnan(y) || ex == 0x7fff) | ||
| 17 | 		return (x*y)/(x*y); | ||
| 18 | 	ux.i.se = ex; | ||
| 19 | 	uy.i.se = ey; | ||
| 20 | 	if (ux.f <= uy.f) { | ||
| 21 | 		if (ux.f == uy.f) | ||
| 22 | 			return 0*x; | ||
| 23 | 		return x; | ||
| 24 | 	} | ||
| 25 | |||
| 26 | 	/* normalize x and y */ | ||
| 27 | 	if (!ex) { | ||
| 28 | 		ux.f *= 0x1p120f; | ||
| 29 | 		ex = ux.i.se - 120; | ||
| 30 | 	} | ||
| 31 | 	if (!ey) { | ||
| 32 | 		uy.f *= 0x1p120f; | ||
| 33 | 		ey = uy.i.se - 120; | ||
| 34 | 	} | ||
| 35 | |||
| 36 | 	/* x mod y */ | ||
| 37 | #if LDBL_MANT_DIG == 64 | ||
| 38 | 	uint64_t i, mx, my; | ||
| 39 | 	mx = ux.i.m; | ||
| 40 | 	my = uy.i.m; | ||
| 41 | 	for (; ex > ey; ex--) { | ||
| 42 | 		i = mx - my; | ||
| 43 | 		if (mx >= my) { | ||
| 44 | 			if (i == 0) | ||
| 45 | 				return 0*x; | ||
| 46 | 			mx = 2*i; | ||
| 47 | 		} else if (2*mx < mx) { | ||
| 48 | 			mx = 2*mx - my; | ||
| 49 | 		} else { | ||
| 50 | 			mx = 2*mx; | ||
| 51 | 		} | ||
| 52 | 	} | ||
| 53 | 	i = mx - my; | ||
| 54 | 	if (mx >= my) { | ||
| 55 | 		if (i == 0) | ||
| 56 | 			return 0*x; | ||
| 57 | 		mx = i; | ||
| 58 | 	} | ||
| 59 | 	for (; mx >> 63 == 0; mx *= 2, ex--); | ||
| 60 | 	ux.i.m = mx; | ||
| 61 | #elif LDBL_MANT_DIG == 113 | ||
| 62 | 	uint64_t hi, lo, xhi, xlo, yhi, ylo; | ||
| 63 | 	xhi = (ux.i2.hi & -1ULL>>16) | 1ULL<<48; | ||
| 64 | 	yhi = (uy.i2.hi & -1ULL>>16) | 1ULL<<48; | ||
| 65 | 	xlo = ux.i2.lo; | ||
| 66 | 	ylo = uy.i2.lo; | ||
| 67 | 	for (; ex > ey; ex--) { | ||
| 68 | 		hi = xhi - yhi; | ||
| 69 | 		lo = xlo - ylo; | ||
| 70 | 		if (xlo < ylo) | ||
| 71 | 			hi -= 1; | ||
| 72 | 		if (hi >> 63 == 0) { | ||
| 73 | 			if ((hi|lo) == 0) | ||
| 74 | 				return 0*x; | ||
| 75 | 			xhi = 2*hi + (lo>>63); | ||
| 76 | 			xlo = 2*lo; | ||
| 77 | 		} else { | ||
| 78 | 			xhi = 2*xhi + (xlo>>63); | ||
| 79 | 			xlo = 2*xlo; | ||
| 80 | 		} | ||
| 81 | 	} | ||
| 82 | 	hi = xhi - yhi; | ||
| 83 | 	lo = xlo - ylo; | ||
| 84 | 	if (xlo < ylo) | ||
| 85 | 		hi -= 1; | ||
| 86 | 	if (hi >> 63 == 0) { | ||
| 87 | 		if ((hi|lo) == 0) | ||
| 88 | 			return 0*x; | ||
| 89 | 		xhi = hi; | ||
| 90 | 		xlo = lo; | ||
| 91 | 	} | ||
| 92 | 	for (; xhi >> 48 == 0; xhi = 2*xhi + (xlo>>63), xlo = 2*xlo, ex--); | ||
| 93 | 	ux.i2.hi = xhi; | ||
| 94 | 	ux.i2.lo = xlo; | ||
| 95 | #endif | ||
| 96 | |||
| 97 | 	/* scale result */ | ||
| 98 | 	if (ex <= 0) { | ||
| 99 | 		ux.i.se = (ex+120)|sx; | ||
| 100 | 		ux.f *= 0x1p-120f; | ||
| 101 | 	} else | ||
| 102 | 		ux.i.se = ex|sx; | ||
| 103 | 	return ux.f; | ||
| 104 | } | ||
| 105 | #endif | ||
src/libs/musl.zig-3| ... | @@ -922,9 +922,6 @@ const src_files = [_][]const u8{ | ... | @@ -922,9 +922,6 @@ const src_files = [_][]const u8{ |
| 922 | "musl/src/math/fmin.c", | 922 | "musl/src/math/fmin.c", |
| 923 | "musl/src/math/fminf.c", | 923 | "musl/src/math/fminf.c", |
| 924 | "musl/src/math/fminl.c", | 924 | "musl/src/math/fminl.c", |
| 925 | "musl/src/math/fmod.c", | ||
| 926 | "musl/src/math/fmodf.c", | ||
| 927 | "musl/src/math/fmodl.c", | ||
| 928 | "musl/src/math/__fpclassify.c", | 925 | "musl/src/math/__fpclassify.c", |
| 929 | "musl/src/math/__fpclassifyf.c", | 926 | "musl/src/math/__fpclassifyf.c", |
| 930 | "musl/src/math/__fpclassifyl.c", | 927 | "musl/src/math/__fpclassifyl.c", |
src/libs/wasi_libc.zig-3| ... | @@ -755,9 +755,6 @@ const libc_top_half_src_files = [_][]const u8{ | ... | @@ -755,9 +755,6 @@ const libc_top_half_src_files = [_][]const u8{ |
| 755 | "musl/src/math/fmaf.c", | 755 | "musl/src/math/fmaf.c", |
| 756 | "musl/src/math/fmaxl.c", | 756 | "musl/src/math/fmaxl.c", |
| 757 | "musl/src/math/fminl.c", | 757 | "musl/src/math/fminl.c", |
| 758 | "musl/src/math/fmod.c", | ||
| 759 | "musl/src/math/fmodf.c", | ||
| 760 | "musl/src/math/fmodl.c", | ||
| 761 | "musl/src/math/frexp.c", | 758 | "musl/src/math/frexp.c", |
| 762 | "musl/src/math/frexpf.c", | 759 | "musl/src/math/frexpf.c", |
| 763 | "musl/src/math/frexpl.c", | 760 | "musl/src/math/frexpl.c", |