diff --git a/CMakeLists.txt b/CMakeLists.txt index d49f7e196..f4e9b02d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -276,7 +276,7 @@ add_executable(c3c src/compiler/expr.c src/utils/time.c src/utils/http.c - ) + src/compiler/sema_liveness.c) if (C3_USE_TB) diff --git a/lib/std/libc/libc.c3 b/lib/std/libc/libc.c3 index 7248a8d61..c64a1a728 100644 --- a/lib/std/libc/libc.c3 +++ b/lib/std/libc/libc.c3 @@ -98,21 +98,21 @@ extern fn void* realloc(void* ptr, usz size); $else: -fn void longjmp(JmpBuf* buffer, CInt value) @weak @extern("longjmp") +fn void longjmp(JmpBuf* buffer, CInt value) @weak @extern("longjmp") @nostrip { unreachable("longjmp unavailable"); } -fn CInt setjmp(JmpBuf* buffer) @weak @extern("setjmp") +fn CInt setjmp(JmpBuf* buffer) @weak @extern("setjmp") @nostrip { unreachable("setjmp unavailable"); } -fn void* malloc(usz size) @weak @extern("malloc") +fn void* malloc(usz size) @weak @extern("malloc") @nostrip { unreachable("malloc unavailable"); } -fn void* calloc(usz count, usz size) @weak @extern("calloc") +fn void* calloc(usz count, usz size) @weak @extern("calloc") @nostrip { unreachable("calloc unavailable"); } @@ -121,23 +121,23 @@ fn void* free(void*) @weak @extern("free") unreachable("free unavailable"); } -fn void* realloc(void* ptr, usz size) @weak @extern("realloc") +fn void* realloc(void* ptr, usz size) @weak @extern("realloc") @nostrip { unreachable("realloc unavailable"); } -fn void* memcpy(void* dest, void* src, usz n) @weak @extern("memcpy") +fn void* memcpy(void* dest, void* src, usz n) @weak @extern("memcpy") @nostrip { for (usz i = 0; i < n; i++) ((char*)dest)[i] = ((char*)src)[i]; return dest; } -fn void* memmove(void* dest, void* src, usz n) @weak @extern("memmove") +fn void* memmove(void* dest, void* src, usz n) @weak @extern("memmove") @nostrip { return memcpy(dest, src, n) @inline; } -fn void* memset(void* dest, CInt value, usz n) @weak @extern("memset") +fn void* memset(void* dest, CInt value, usz n) @weak @extern("memset") @nostrip { for (usz i = 0; i < n; i++) ((char*)dest)[i] = (char)value; return dest; @@ -246,69 +246,69 @@ extern fn isz getline(char** linep, usz* linecapp, CFile stream); $else: -fn int fseek(CFile stream, SeekIndex offset, int whence) @weak @extern("fseek") +fn int fseek(CFile stream, SeekIndex offset, int whence) @weak @extern("fseek") @nostrip { unreachable("'fseek' not available."); } -fn CFile fopen(ZString filename, ZString mode) @weak @extern("fopen") +fn CFile fopen(ZString filename, ZString mode) @weak @extern("fopen") @nostrip { unreachable("'fopen' not available."); } -fn CFile freopen(ZString filename, ZString mode, CFile stream) @weak @extern("fopen") +fn CFile freopen(ZString filename, ZString mode, CFile stream) @weak @extern("fopen") @nostrip { unreachable("'freopen' not available."); } -fn usz fwrite(void* ptr, usz size, usz nmemb, CFile stream) @weak @extern("fwrite") +fn usz fwrite(void* ptr, usz size, usz nmemb, CFile stream) @weak @extern("fwrite") @nostrip { unreachable("'fwrite' not available."); } -fn usz fread(void* ptr, usz size, usz nmemb, CFile stream) @weak @extern("fread") +fn usz fread(void* ptr, usz size, usz nmemb, CFile stream) @weak @extern("fread") @nostrip { unreachable("'fread' not available."); } -fn CFile fclose(CFile) @weak @extern("fclose") +fn CFile fclose(CFile) @weak @extern("fclose") @nostrip { unreachable("'fclose' not available."); } -fn int fflush(CFile stream) @weak @extern("fflush") +fn int fflush(CFile stream) @weak @extern("fflush") @nostrip { unreachable("'fflush' not available."); } -fn int fputc(int c, CFile stream) @weak @extern("fputc") +fn int fputc(int c, CFile stream) @weak @extern("fputc") @nostrip { unreachable("'fputc' not available."); } -fn char* fgets(ZString str, int n, CFile stream) @weak @extern("fgets") +fn char* fgets(ZString str, int n, CFile stream) @weak @extern("fgets") @nostrip { unreachable("'fgets' not available."); } -fn int fgetc(CFile stream) @weak @extern("fgetc") +fn int fgetc(CFile stream) @weak @extern("fgetc") @nostrip { unreachable("'fgetc' not available."); } -fn int feof(CFile stream) @weak @extern("feof") +fn int feof(CFile stream) @weak @extern("feof") @nostrip { unreachable("'feof' not available."); } -fn int putc(int c, CFile stream) @weak @extern("putc") +fn int putc(int c, CFile stream) @weak @extern("putc") @nostrip { unreachable("'putc' not available."); } -fn int putchar(int c) @weak @extern("putchar") +fn int putchar(int c) @weak @extern("putchar") @nostrip { unreachable("'putchar' not available."); } -fn int puts(ZString str) @weak @extern("puts") +fn int puts(ZString str) @weak @extern("puts") @nostrip { unreachable("'puts' not available."); } diff --git a/lib/std/math/math_builtin.c3 b/lib/std/math/math_builtin.c3 index 9ea8a8cd2..7a8562456 100644 --- a/lib/std/math/math_builtin.c3 +++ b/lib/std/math/math_builtin.c3 @@ -1,12 +1,12 @@ module std::math; -fn float __roundevenf(float f) @extern("roundevenf") @weak +fn float __roundevenf(float f) @extern("roundevenf") @weak @nostrip { // Slow implementation return round(f / 2) * 2; } -fn double __roundeven(double d) @extern("roundeven") @weak +fn double __roundeven(double d) @extern("roundeven") @weak @nostrip { // Slow implementation return round(d / 2) * 2; diff --git a/lib/std/math/math_i128.c3 b/lib/std/math/math_i128.c3 index 89d7039d7..95380027f 100644 --- a/lib/std/math/math_i128.c3 +++ b/lib/std/math/math_i128.c3 @@ -1,6 +1,6 @@ module std::math; -fn int128 __divti3(int128 a, int128 b) @extern("__divti3") @weak +fn int128 __divti3(int128 a, int128 b) @extern("__divti3") @weak @nostrip { int128 sign_a = a >> 127; // -1 : 0 int128 sign_b = b >> 127; // -1 : 0 @@ -10,7 +10,7 @@ fn int128 __divti3(int128 a, int128 b) @extern("__divti3") @weak return __udivti3(unsigned_a, unsigned_b) @inline ^ sign_a + (-sign_a); } -fn uint128 __umodti3(uint128 n, uint128 d) @extern("__umodti3") @weak +fn uint128 __umodti3(uint128 n, uint128 d) @extern("__umodti3") @weak @nostrip { // Ignore d = 0 uint128 sr = (d ? $$clz(d) : 128) - (n ? $$clz(n) : 128); @@ -34,7 +34,7 @@ fn uint128 __umodti3(uint128 n, uint128 d) @extern("__umodti3") @weak return r; } -fn uint128 __udivti3(uint128 n, uint128 d) @extern("__udivti3") @weak +fn uint128 __udivti3(uint128 n, uint128 d) @extern("__udivti3") @weak @nostrip { // Ignore d = 0 uint128 sr = (d ? $$clz(d) : 128) - (n ? $$clz(n) : 128); @@ -60,7 +60,7 @@ fn uint128 __udivti3(uint128 n, uint128 d) @extern("__udivti3") @weak return n; } -fn int128 __modti3(int128 a, int128 b) @extern("__modti3") @weak +fn int128 __modti3(int128 a, int128 b) @extern("__modti3") @weak @nostrip { int128 sign = b >> 127; uint128 unsigned_b = (uint128)(b ^ sign) + (-sign); @@ -83,7 +83,7 @@ union Int128bits @private uint128 all; } -fn uint128 __lshrti3(uint128 a, uint b) @extern("__lshrti3") @weak +fn uint128 __lshrti3(uint128 a, uint b) @extern("__lshrti3") @weak @nostrip { Int128bits result; result.all = a; @@ -101,7 +101,7 @@ fn uint128 __lshrti3(uint128 a, uint b) @extern("__lshrti3") @weak return result.all; } -fn int128 __ashrti3(int128 a, uint b) @extern("__ashrti3") @weak +fn int128 __ashrti3(int128 a, uint b) @extern("__ashrti3") @weak @nostrip { Int128bits result; result.all = a; @@ -119,7 +119,7 @@ fn int128 __ashrti3(int128 a, uint b) @extern("__ashrti3") @weak return result.all; } -fn int128 __ashlti3(int128 a, uint b) @extern("__ashlti3") @weak +fn int128 __ashlti3(int128 a, uint b) @extern("__ashlti3") @weak @nostrip { Int128bits result; result.all = a; @@ -158,7 +158,7 @@ fn int128 __mulddi3(ulong a, ulong b) @private return r.all; } -fn int128 __multi3(int128 a, int128 b) @extern("__multi3") @weak +fn int128 __multi3(int128 a, int128 b) @extern("__multi3") @weak @nostrip { Int128bits x = { .all = a }; Int128bits y = { .all = b }; @@ -167,14 +167,14 @@ fn int128 __multi3(int128 a, int128 b) @extern("__multi3") @weak return r.all; } -fn float __floattisf(int128 a) @extern("__floattisf") @weak => float_from_i128(float, a); -fn double __floattidf(int128 a) @extern("__floattidf") @weak => float_from_i128(double, a); -fn float __floatuntisf(uint128 a) @extern("__floatuntisf") @weak => float_from_u128(float, a); -fn double __floatuntidf(uint128 a) @extern("__floatuntidf") @weak => float_from_u128(double, a); -fn uint128 __fixunsdfti(double a) @weak @extern("__fixunsdfti") => fixuint(a); -fn uint128 __fixunssfti(float a) @weak @extern("__fixunssfti") => fixuint(a); -fn int128 __fixdfti(double a) @weak @extern("__fixdfti") => fixint(a); -fn int128 __fixsfti(float a) @weak @extern("__fixsfti") => fixint(a); +fn float __floattisf(int128 a) @extern("__floattisf") @weak @nostrip => float_from_i128(float, a); +fn double __floattidf(int128 a) @extern("__floattidf") @weak @nostrip => float_from_i128(double, a); +fn float __floatuntisf(uint128 a) @extern("__floatuntisf") @weak @nostrip => float_from_u128(float, a); +fn double __floatuntidf(uint128 a) @extern("__floatuntidf") @weak @nostrip => float_from_u128(double, a); +fn uint128 __fixunsdfti(double a) @weak @extern("__fixunsdfti") @nostrip => fixuint(a); +fn uint128 __fixunssfti(float a) @weak @extern("__fixunssfti") @nostrip => fixuint(a); +fn int128 __fixdfti(double a) @weak @extern("__fixdfti") @nostrip => fixint(a); +fn int128 __fixsfti(float a) @weak @extern("__fixsfti") @nostrip => fixint(a); macro float_from_i128($Type, a) @private diff --git a/lib/std/math/math_nolibc/__cos.c3 b/lib/std/math/math_nolibc/__cos.c3 index da169620c..59baeb0bf 100644 --- a/lib/std/math/math_nolibc/__cos.c3 +++ b/lib/std/math/math_nolibc/__cos.c3 @@ -14,7 +14,7 @@ $if (!env::COMPILER_LIBC_AVAILABLE): * ==================================================== */ -fn double __cos(double x, double y) @extern("__cos") @weak +fn double __cos(double x, double y) @extern("__cos") @weak @nostrip { const C1 = 4.16666666666666019037e-02; /* 0x3FA55555, 0x5555554C */ const C2 = -1.38888888888741095749e-03; /* 0xBF56C16C, 0x16C15177 */ diff --git a/lib/std/math/math_nolibc/__cosdf.c3 b/lib/std/math/math_nolibc/__cosdf.c3 index 6d63bc6a3..f77c14b02 100644 --- a/lib/std/math/math_nolibc/__cosdf.c3 +++ b/lib/std/math/math_nolibc/__cosdf.c3 @@ -24,7 +24,7 @@ const double C1 @private = 0x155553e1053a42.0p-57; /* 0.0416666233237390631894 const double C2 @private = -0x16c087e80f1e27.0p-62; /* -0.00138867637746099294692 */ const double C3 @private = 0x199342e0ee5069.0p-68; /* 0.0000243904487962774090654 */ -fn float __cosdf(double x) @extern("__cosdf") @weak +fn float __cosdf(double x) @extern("__cosdf") @weak @nostrip { /* Try to optimize for parallel evaluation as in __tandf.c. */ double z = x * x; diff --git a/lib/std/math/math_nolibc/__sin.c3 b/lib/std/math/math_nolibc/__sin.c3 index 298bd4899..4326ac43d 100644 --- a/lib/std/math/math_nolibc/__sin.c3 +++ b/lib/std/math/math_nolibc/__sin.c3 @@ -13,7 +13,7 @@ $if (!env::COMPILER_LIBC_AVAILABLE): * is preserved. * ==================================================== */ -fn double __sin(double x, double y, int iy) @extern("__sin") @weak +fn double __sin(double x, double y, int iy) @extern("__sin") @weak @nostrip { const S1 = -1.66666666666666324348e-01; /* 0xBFC55555, 0x55555549 */ diff --git a/lib/std/math/math_nolibc/__sindf.c3 b/lib/std/math/math_nolibc/__sindf.c3 index 7a0c95225..36090e1bc 100644 --- a/lib/std/math/math_nolibc/__sindf.c3 +++ b/lib/std/math/math_nolibc/__sindf.c3 @@ -18,7 +18,7 @@ $if (!env::COMPILER_LIBC_AVAILABLE): * ==================================================== */ // |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). -fn float __sindf(double x) @extern("__sindf") @weak +fn float __sindf(double x) @extern("__sindf") @weak @nostrip { const S1F = -0x15555554cbac77.0p-55; /* -0.166666666416265235595 */ const S2F = 0x111110896efbb2.0p-59; /* 0.0083333293858894631756 */ diff --git a/lib/std/math/math_nolibc/__tan.c3 b/lib/std/math/math_nolibc/__tan.c3 index d5801de57..1b6533480 100644 --- a/lib/std/math/math_nolibc/__tan.c3 +++ b/lib/std/math/math_nolibc/__tan.c3 @@ -29,7 +29,7 @@ const double[*] TAN_T = { 2.59073051863633712884e-05, /* 3EFB2A70, 74BF7AD4 */ }; -fn double __tan(double x, double y, int odd) @extern("__tan") @weak +fn double __tan(double x, double y, int odd) @extern("__tan") @weak @nostrip { const double PIO4 = 7.85398163397448278999e-01; /* 3FE921FB, 54442D18 */ const double PIO4LO = 3.06161699786838301793e-17; /* 3C81A626, 33145C07 */ diff --git a/lib/std/math/math_nolibc/__tandf.c3 b/lib/std/math/math_nolibc/__tandf.c3 index ea87625b5..a1dd93b41 100644 --- a/lib/std/math/math_nolibc/__tandf.c3 +++ b/lib/std/math/math_nolibc/__tandf.c3 @@ -27,7 +27,7 @@ const double[*] TANDF = { 0x1362b9bf971bcd.0p-59, /* 0.00946564784943673166728 */ }; -fn float __tandf(double x, int odd) @extern("__tandf") @weak +fn float __tandf(double x, int odd) @extern("__tandf") @weak @nostrip { double z = x * x; /* diff --git a/lib/std/math/math_nolibc/atan.c3 b/lib/std/math/math_nolibc/atan.c3 index 5eee61767..75db3f088 100644 --- a/lib/std/math/math_nolibc/atan.c3 +++ b/lib/std/math/math_nolibc/atan.c3 @@ -30,7 +30,7 @@ const double[*] AT @private = { 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ }; -fn double _atan(double x) @weak @extern("atan") +fn double _atan(double x) @weak @extern("atan") @nostrip { int id @noinit; uint ix = x.high_word(); @@ -113,7 +113,7 @@ const float[*] ATF @private = { 6.1687607318e-02, }; -fn float _atanf(float x) @weak @extern("atanf") +fn float _atanf(float x) @weak @extern("atanf") @nostrip { int id @noinit; uint ix = x.word(); @@ -186,7 +186,7 @@ macro void extract_words(double d, uint* hi, uint* lo) @private *lo = (uint)rep; } -fn double _atan2(double y, double x) @weak @extern("atan2") +fn double _atan2(double y, double x) @weak @extern("atan2") @nostrip { if (math::is_nan(x) || math::is_nan(y)) return x + y; @@ -257,7 +257,7 @@ fn double _atan2(double y, double x) @weak @extern("atan2") const float PI_F @private = 3.1415927410e+00; /* 0x40490fdb */ const float PI_LO_F @private = -8.7422776573e-08; /* 0xb3bbbd2e */ -fn float _atan2f(float y, float x) @weak @extern("atan2f") +fn float _atan2f(float y, float x) @weak @extern("atan2f") @nostrip { if (math::is_nan(x) || math::is_nan(y)) return x + y; uint ix = bitcast(x, uint); diff --git a/lib/std/math/math_nolibc/ceil.c3 b/lib/std/math/math_nolibc/ceil.c3 index 3f648b196..191660ec1 100644 --- a/lib/std/math/math_nolibc/ceil.c3 +++ b/lib/std/math/math_nolibc/ceil.c3 @@ -2,7 +2,7 @@ module std::math::nolibc; $if (!env::COMPILER_LIBC_AVAILABLE): -fn double _ceil(double x) @weak @extern("ceil") +fn double _ceil(double x) @weak @extern("ceil") @nostrip { ulong ui = bitcast(x, ulong); int e = (int)((ui >> 52) & 0x7ff); @@ -19,7 +19,7 @@ fn double _ceil(double x) @weak @extern("ceil") } -fn float _ceilf(float x) @weak @extern("ceilf") +fn float _ceilf(float x) @weak @extern("ceilf") @nostrip { uint u = bitcast(x, uint); int e = (int)((u >> 23) & 0xff) - 0x7f; diff --git a/lib/std/math/math_nolibc/cos.c3 b/lib/std/math/math_nolibc/cos.c3 index df4bd8322..fb9d56e1f 100644 --- a/lib/std/math/math_nolibc/cos.c3 +++ b/lib/std/math/math_nolibc/cos.c3 @@ -2,7 +2,7 @@ module std::math::nolibc; $if (!env::COMPILER_LIBC_AVAILABLE): -fn float _cosf(float x) @extern("cosf") @weak +fn float _cosf(float x) @extern("cosf") @weak @nostrip { uint ix = bitcast(x, uint); uint sign = ix >> 31; @@ -54,7 +54,7 @@ fn float _cosf(float x) @extern("cosf") @weak * ==================================================== */ -fn double _cos(double x) @extern("cos") @weak +fn double _cos(double x) @extern("cos") @weak @nostrip { // High word of x. uint ix = (uint)(bitcast(x, ulong) >> 32); diff --git a/lib/std/math/math_nolibc/exp2.c3 b/lib/std/math/math_nolibc/exp2.c3 index 48f53ce04..6e41ff0d1 100644 --- a/lib/std/math/math_nolibc/exp2.c3 +++ b/lib/std/math/math_nolibc/exp2.c3 @@ -5,7 +5,7 @@ $if (!env::COMPILER_LIBC_AVAILABLE): macro uint _top12f(float x) @private => bitcast(x, uint) >> 20; -fn float _exp2f(float x) @extern("exp2f") @weak +fn float _exp2f(float x) @extern("exp2f") @weak @nostrip { double xd = x; uint abstop = _top12f(x) & 0x7ff; @@ -82,7 +82,7 @@ macro uint _top12d(double x) @private return (uint)(bitcast(x, ulong) >> 52); } -fn double _exp2(double x) @extern("exp2") @weak +fn double _exp2(double x) @extern("exp2") @weak @nostrip { uint abstop = _top12d(x) & 0x7ff; ulong u = bitcast(x, ulong); diff --git a/lib/std/math/math_nolibc/floor.c3 b/lib/std/math/math_nolibc/floor.c3 index 9c9f5be32..278c0405f 100644 --- a/lib/std/math/math_nolibc/floor.c3 +++ b/lib/std/math/math_nolibc/floor.c3 @@ -2,7 +2,7 @@ module std::math::nolibc; $if (!env::COMPILER_LIBC_AVAILABLE): -fn double _floor(double x) @weak @extern("floor") +fn double _floor(double x) @weak @extern("floor") @nostrip { ulong ui = bitcast(x, ulong); int e = (int)((ui >> 52) & 0x7ff); @@ -19,7 +19,7 @@ fn double _floor(double x) @weak @extern("floor") } -fn float _floorf(float x) @weak @extern("floorf") +fn float _floorf(float x) @weak @extern("floorf") @nostrip { uint u = bitcast(x, uint); int e = (int)((u >> 23) & 0xff) - 0x7f; diff --git a/lib/std/math/math_nolibc/pow.c3 b/lib/std/math/math_nolibc/pow.c3 index c64cd6392..eaadb56dd 100644 --- a/lib/std/math/math_nolibc/pow.c3 +++ b/lib/std/math/math_nolibc/pow.c3 @@ -2,12 +2,12 @@ module std::math::nolibc; $if (!env::COMPILER_LIBC_AVAILABLE): -fn float powf_broken(float x, float f) @extern("powf") @weak +fn float powf_broken(float x, float f) @extern("powf") @weak @nostrip { unreachable("'powf' not supported"); } -fn double pow_broken(double x, double y) @extern("pow") @weak +fn double pow_broken(double x, double y) @extern("pow") @weak @nostrip { unreachable("'pow' not supported"); } diff --git a/lib/std/math/math_nolibc/round.c3 b/lib/std/math/math_nolibc/round.c3 index e320d227a..a1cbd366e 100644 --- a/lib/std/math/math_nolibc/round.c3 +++ b/lib/std/math/math_nolibc/round.c3 @@ -2,7 +2,7 @@ module std::math::nolibc; $if (!env::COMPILER_LIBC_AVAILABLE): -fn double _round(double x) @extern("round") @weak +fn double _round(double x) @extern("round") @weak @nostrip { ulong u = bitcast(x, ulong); int e = (int)((u >> 52) & 0x7ff); @@ -28,7 +28,7 @@ fn double _round(double x) @extern("round") @weak return y; } -fn float _roundf(float x) @extern("roundf") @weak +fn float _roundf(float x) @extern("roundf") @weak @nostrip { uint u = bitcast(x, uint); int e = (u >> 23) & 0xff; diff --git a/lib/std/math/math_nolibc/scalbn.c3 b/lib/std/math/math_nolibc/scalbn.c3 index a8c390934..8bc38e939 100644 --- a/lib/std/math/math_nolibc/scalbn.c3 +++ b/lib/std/math/math_nolibc/scalbn.c3 @@ -2,7 +2,7 @@ module std::math::nolibc; $if (!env::COMPILER_LIBC_AVAILABLE): -fn double _scalbn(double x, int n) @weak @extern("scalbn") +fn double _scalbn(double x, int n) @weak @extern("scalbn") @nostrip { switch { diff --git a/lib/std/math/math_nolibc/sin.c3 b/lib/std/math/math_nolibc/sin.c3 index 9f5a6bdee..9e317c13b 100644 --- a/lib/std/math/math_nolibc/sin.c3 +++ b/lib/std/math/math_nolibc/sin.c3 @@ -18,7 +18,7 @@ $if (!env::COMPILER_LIBC_AVAILABLE): * ==================================================== */ -fn float _sinf(float x) @weak @extern("sinf") +fn float _sinf(float x) @weak @extern("sinf") @nostrip { uint ix = bitcast(x, uint); int sign = ix >> 31; @@ -87,7 +87,7 @@ fn float _sinf(float x) @weak @extern("sinf") * ==================================================== */ -fn double sin(double x) @extern("sin") @weak +fn double sin(double x) @extern("sin") @weak @nostrip { // High word of x. uint ix = (uint)(bitcast(x, ulong) >> 32); diff --git a/lib/std/math/math_nolibc/sincos.c3 b/lib/std/math/math_nolibc/sincos.c3 index 192840715..6d1b35775 100644 --- a/lib/std/math/math_nolibc/sincos.c3 +++ b/lib/std/math/math_nolibc/sincos.c3 @@ -18,7 +18,7 @@ $if (!env::COMPILER_LIBC_AVAILABLE): * ==================================================== */ -fn void sincosf(float x, float *sin, float *cos) @extern("sincosf") @weak +fn void sincosf(float x, float *sin, float *cos) @extern("sincosf") @weak @nostrip { uint ix = bitcast(x, uint); @@ -107,7 +107,7 @@ fn void sincosf(float x, float *sin, float *cos) @extern("sincosf") @weak } -fn void sincos(double x, double *sin, double *cos) @extern("sincos") @weak +fn void sincos(double x, double *sin, double *cos) @extern("sincos") @weak @nostrip { // High word of x. uint ix = (uint)(bitcast(x, ulong) >> 32); diff --git a/lib/std/math/math_nolibc/tan.c3 b/lib/std/math/math_nolibc/tan.c3 index 95fb73ce2..5f27d1649 100644 --- a/lib/std/math/math_nolibc/tan.c3 +++ b/lib/std/math/math_nolibc/tan.c3 @@ -14,7 +14,7 @@ $if (!env::COMPILER_LIBC_AVAILABLE): * ==================================================== */ -fn double tan(double x) @extern("tan") @weak +fn double tan(double x) @extern("tan") @weak @nostrip { uint ix = (uint)(bitcast(x, ulong) >> 32); ix &= 0x7fffffff; @@ -59,7 +59,7 @@ fn double tan(double x) @extern("tan") @weak * ==================================================== */ -fn float tanf(float x) @extern("tanf") @weak +fn float tanf(float x) @extern("tanf") @weak @nostrip { uint ix = bitcast(x, uint); uint sign = ix >> 31; diff --git a/lib/std/math/math_nolibc/trig.c3 b/lib/std/math/math_nolibc/trig.c3 index 39aa6b131..c47bea0d9 100644 --- a/lib/std/math/math_nolibc/trig.c3 +++ b/lib/std/math/math_nolibc/trig.c3 @@ -2,7 +2,7 @@ module std::math::nolibc::trig; $if (!env::COMPILER_LIBC_AVAILABLE): -fn double sincos_broken(double x) @extern("sincos") @weak +fn double sincos_broken(double x) @extern("sincos") @weak @nostrip { unreachable("'sinccos' not supported"); } diff --git a/lib/std/math/math_nolibc/trunc.c3 b/lib/std/math/math_nolibc/trunc.c3 index e108a6359..6284c142f 100644 --- a/lib/std/math/math_nolibc/trunc.c3 +++ b/lib/std/math/math_nolibc/trunc.c3 @@ -2,7 +2,7 @@ module std::math::nolibc; $if (!env::COMPILER_LIBC_AVAILABLE): -fn double _trunc(double x) @weak @extern("trunc") +fn double _trunc(double x) @weak @extern("trunc") @nostrip { ulong i = bitcast(x, ulong); int e = (int)((i >> 52) & 0x7ff) - 0x3ff + 12; @@ -15,7 +15,7 @@ fn double _trunc(double x) @weak @extern("trunc") return bitcast(i, double); } -fn float _truncf(float x) @weak @extern("truncf") +fn float _truncf(float x) @weak @extern("truncf") @nostrip { uint i = bitcast(x, uint); int e = (int)((i >> 23) & 0xff) - 0x7f + 9; diff --git a/src/build/build_options.c b/src/build/build_options.c index 6ddc3e1d0..52c6725a5 100644 --- a/src/build/build_options.c +++ b/src/build/build_options.c @@ -133,6 +133,7 @@ static void usage(void) OUTPUT(" --x86vec=