#include #include #include // ---------------------------------------------------------------------------- // Math Stubs (To avoid libcompiler_rt math.o) // ---------------------------------------------------------------------------- double tan(double x) { return 0.0; } double trunc(double x) { return (int64_t)x; } float tanf(float x) { return 0.0f; } float truncf(float x) { return (int32_t)x; } double ceil(double x) { long long i = (long long)x; if (x > i) return i + 1; return i; } double floor(double x) { long long i = (long long)x; if (x < i) return i - 1; return i; } double fmod(double x, double y) { return 0.0; } // Stub /* atomic overrides commented out to prefer stubs.zig // ---------------------------------------------------------------------------- // Atomic Overrides (To avoid libcompiler_rt atomics.o which uses medlow) // ---------------------------------------------------------------------------- // These are called when the hardware doesn't support the size (e.g., 128-bit). // Since we are single-threaded (or cooperative) on this core, we can cheat. // WARNING: Not SMP safe without a global lock. void ops_atomic_load(size_t size, void *ptr, void *ret, int model) { char *d = (char *)ret; char *s = (char *)ptr; for(size_t i=0; i> 64) == 0 && (n >> 64) == 0) { return (uint128_t)((uint64_t)n / (uint64_t)d); } return 0; } // Float extensions // RISC-V Q-extension emulation? long double __extenddftf2(double a) { return (long double)a; // This might call itself recursively if compiled without Q? // If we loop, we need a hard stub. // return 0.0L; } long double __extendxftf2(long double a) { return a; }