@zigc/lib 0.16.0-test.1 → 0.17.0-dev.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/c/fcntl.zig +6 -1
- package/c/inttypes.zig +0 -10
- package/c/math.zig +138 -114
- package/c/pthread.zig +57 -0
- package/c/search.zig +1 -27
- package/c/stdlib/drand48.zig +0 -57
- package/c/stdlib.zig +0 -100
- package/c/string.zig +20 -7
- package/c/strings.zig +0 -38
- package/c/stropts.zig +17 -0
- package/c/unistd.zig +27 -26
- package/c/wchar.zig +10 -0
- package/c.zig +3 -2
- package/compiler/aro/aro/Attribute/names.zig +604 -589
- package/compiler/aro/aro/Attribute.zig +202 -116
- package/compiler/aro/aro/Builtins/common.zig +874 -863
- package/compiler/aro/aro/Builtins/eval.zig +15 -7
- package/compiler/aro/aro/Builtins.zig +0 -1
- package/compiler/aro/aro/CodeGen.zig +8 -7
- package/compiler/aro/aro/Compilation.zig +137 -111
- package/compiler/aro/aro/Diagnostics.zig +21 -17
- package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
- package/compiler/aro/aro/Driver.zig +138 -63
- package/compiler/aro/aro/LangOpts.zig +12 -2
- package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
- package/compiler/aro/aro/Parser.zig +352 -153
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
- package/compiler/aro/aro/Preprocessor.zig +136 -62
- package/compiler/aro/aro/Target.zig +17 -12
- package/compiler/aro/aro/Tokenizer.zig +31 -14
- package/compiler/aro/aro/Toolchain.zig +4 -7
- package/compiler/aro/aro/Tree.zig +178 -148
- package/compiler/aro/aro/TypeStore.zig +82 -24
- package/compiler/aro/aro/Value.zig +13 -17
- package/compiler/aro/aro/features.zig +1 -0
- package/compiler/aro/aro/pragmas/message.zig +3 -2
- package/compiler/aro/aro/pragmas/once.zig +0 -1
- package/compiler/aro/aro/record_layout.zig +3 -3
- package/compiler/aro/aro/text_literal.zig +3 -2
- package/compiler/aro/assembly_backend/x86_64.zig +7 -8
- package/compiler/aro/backend/Assembly.zig +1 -2
- package/compiler/aro/backend/Interner.zig +2 -2
- package/compiler/aro/backend/Ir.zig +100 -92
- package/compiler/aro/include/ptrcheck.h +49 -0
- package/compiler/aro/main.zig +26 -10
- package/compiler/build_runner.zig +1 -2
- package/compiler/objdump.zig +93 -0
- package/compiler/reduce/Walk.zig +7 -7
- package/compiler/reduce.zig +5 -1
- package/compiler/resinator/compile.zig +2 -2
- package/compiler/resinator/main.zig +7 -1
- package/compiler/resinator/preprocess.zig +1 -3
- package/compiler/std-docs.zig +8 -1
- package/compiler/test_runner.zig +194 -62
- package/compiler/translate-c/MacroTranslator.zig +80 -11
- package/compiler/translate-c/PatternList.zig +1 -9
- package/compiler/translate-c/Scope.zig +43 -6
- package/compiler/translate-c/Translator.zig +369 -127
- package/compiler/translate-c/ast.zig +19 -11
- package/compiler/translate-c/main.zig +76 -17
- package/compiler_rt/cos.zig +140 -53
- package/compiler_rt/divmodei4.zig +40 -17
- package/compiler_rt/exp.zig +1 -6
- package/compiler_rt/exp2.zig +1 -6
- package/compiler_rt/exp_f128.zig +377 -0
- package/compiler_rt/fabs.zig +0 -2
- package/compiler_rt/fma.zig +0 -2
- package/compiler_rt/fmax.zig +0 -2
- package/compiler_rt/fmin.zig +0 -2
- package/compiler_rt/fmod.zig +0 -2
- package/compiler_rt/limb64.zig +1127 -0
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/mulXi3.zig +1 -1
- package/compiler_rt/mulo.zig +6 -1
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +139 -56
- package/compiler_rt/sincos.zig +277 -72
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/ssp.zig +1 -1
- package/compiler_rt/tan.zig +117 -48
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt/trunc.zig +0 -2
- package/compiler_rt/udivmodei4.zig +28 -0
- package/compiler_rt.zig +2 -0
- package/fuzzer.zig +857 -307
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/libc/musl/src/math/pow.c +343 -0
- package/package.json +1 -1
- package/std/Build/Cache.zig +6 -6
- package/std/Build/Fuzz.zig +6 -19
- package/std/Build/Module.zig +1 -1
- package/std/Build/Step/CheckObject.zig +3 -3
- package/std/Build/Step/Compile.zig +18 -1
- package/std/Build/Step/ConfigHeader.zig +49 -33
- package/std/Build/Step/InstallArtifact.zig +18 -0
- package/std/Build/Step/Run.zig +538 -89
- package/std/Build/Step/TranslateC.zig +0 -6
- package/std/Build/Step.zig +10 -19
- package/std/Build/WebServer.zig +31 -19
- package/std/Build/abi.zig +47 -11
- package/std/Build.zig +17 -17
- package/std/Io/Dir.zig +7 -2
- package/std/Io/Dispatch.zig +5 -13
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/File/Writer.zig +8 -6
- package/std/Io/File.zig +1 -0
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io/Reader.zig +8 -9
- package/std/Io/Semaphore.zig +112 -17
- package/std/Io/Terminal.zig +1 -1
- package/std/Io/Threaded.zig +352 -180
- package/std/Io/Uring.zig +15 -16
- package/std/Io/Writer.zig +46 -42
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +1052 -20
- package/std/SemanticVersion.zig +1 -1
- package/std/Target/Query.zig +2 -2
- package/std/Target.zig +53 -7
- package/std/Thread.zig +8 -3
- package/std/array_hash_map.zig +105 -573
- package/std/array_list.zig +22 -31
- package/std/bit_set.zig +22 -6
- package/std/builtin/assembly.zig +68 -0
- package/std/builtin.zig +4 -0
- package/std/c/haiku.zig +3 -0
- package/std/c/serenity.zig +1 -6
- package/std/c.zig +106 -24
- package/std/compress/flate/Compress.zig +3 -3
- package/std/compress/flate/Decompress.zig +2 -3
- package/std/compress/zstd/Decompress.zig +2 -4
- package/std/crypto/Certificate/Bundle.zig +15 -1
- package/std/crypto/Certificate.zig +13 -1
- package/std/crypto/ascon.zig +75 -33
- package/std/crypto/codecs/asn1/Oid.zig +12 -1
- package/std/crypto/codecs/asn1.zig +33 -18
- package/std/crypto/codecs/base64_hex_ct.zig +16 -8
- package/std/crypto/ml_kem.zig +2 -9
- package/std/crypto/tls/Client.zig +79 -4
- package/std/crypto/tls.zig +1 -1
- package/std/crypto.zig +1 -0
- package/std/debug/Dwarf.zig +29 -9
- package/std/debug/Info.zig +4 -0
- package/std/debug/MachOFile.zig +46 -8
- package/std/debug/Pdb.zig +540 -37
- package/std/debug/SelfInfo/Elf.zig +19 -18
- package/std/debug/SelfInfo/MachO.zig +18 -7
- package/std/debug/SelfInfo/Windows.zig +138 -36
- package/std/debug.zig +181 -66
- package/std/enums.zig +25 -19
- package/std/fmt.zig +8 -3
- package/std/fs/path.zig +6 -4
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap/debug_allocator.zig +7 -7
- package/std/heap.zig +2 -126
- package/std/http/Client.zig +31 -30
- package/std/http.zig +14 -13
- package/std/json/Scanner.zig +2 -2
- package/std/json/Stringify.zig +3 -3
- package/std/json/dynamic.zig +4 -4
- package/std/math/big/int.zig +16 -17
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/os/emscripten.zig +2 -18
- package/std/os/linux/IoUring.zig +2 -0
- package/std/os/linux/aarch64.zig +41 -12
- package/std/os/linux/arc.zig +173 -0
- package/std/os/linux/arm.zig +41 -12
- package/std/os/linux/hexagon.zig +33 -11
- package/std/os/linux/loongarch32.zig +41 -13
- package/std/os/linux/loongarch64.zig +41 -12
- package/std/os/linux/m68k.zig +41 -13
- package/std/os/linux/mips.zig +67 -36
- package/std/os/linux/mips64.zig +60 -29
- package/std/os/linux/mipsn32.zig +60 -29
- package/std/os/linux/or1k.zig +41 -12
- package/std/os/linux/powerpc.zig +41 -12
- package/std/os/linux/powerpc64.zig +41 -12
- package/std/os/linux/riscv32.zig +41 -12
- package/std/os/linux/riscv64.zig +41 -12
- package/std/os/linux/s390x.zig +44 -7
- package/std/os/linux/sparc64.zig +83 -52
- package/std/os/linux/thumb.zig +52 -36
- package/std/os/linux/x32.zig +41 -12
- package/std/os/linux/x86.zig +42 -13
- package/std/os/linux/x86_64.zig +41 -12
- package/std/os/linux.zig +419 -438
- package/std/os/uefi/tables/boot_services.zig +9 -8
- package/std/os/windows.zig +2 -2
- package/std/os.zig +41 -0
- package/std/pdb.zig +143 -4
- package/std/posix.zig +6 -12
- package/std/priority_dequeue.zig +13 -12
- package/std/priority_queue.zig +5 -4
- package/std/process/Child.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/process.zig +1 -1
- package/std/sort.zig +3 -3
- package/std/start.zig +17 -4
- package/std/std.zig +19 -6
- package/std/testing/FailingAllocator.zig +4 -4
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +187 -459
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstGen.zig +86 -103
- package/std/zig/AstRlAnnotate.zig +0 -11
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/Client.zig +8 -3
- package/std/zig/LibCInstallation.zig +4 -3
- package/std/zig/Parse.zig +90 -81
- package/std/zig/Server.zig +26 -0
- package/std/zig/WindowsSdk.zig +13 -13
- package/std/zig/Zir.zig +66 -62
- package/std/zig/ZonGen.zig +6 -5
- package/std/zig/c_translation/helpers.zig +14 -9
- package/std/zig/llvm/Builder.zig +119 -60
- package/std/zig/system.zig +20 -4
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +7 -10
- package/std/zip.zig +5 -5
- package/zig.h +340 -1
- package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
- package/libc/mingw/complex/cabs.c +0 -48
- package/libc/mingw/complex/cabsf.c +0 -48
- package/libc/mingw/complex/cacos.c +0 -50
- package/libc/mingw/complex/cacosf.c +0 -50
- package/libc/mingw/complex/carg.c +0 -48
- package/libc/mingw/complex/cargf.c +0 -48
- package/libc/mingw/complex/casin.c +0 -50
- package/libc/mingw/complex/casinf.c +0 -50
- package/libc/mingw/complex/catan.c +0 -50
- package/libc/mingw/complex/catanf.c +0 -50
- package/libc/mingw/complex/ccos.c +0 -50
- package/libc/mingw/complex/ccosf.c +0 -50
- package/libc/mingw/complex/cexp.c +0 -48
- package/libc/mingw/complex/cexpf.c +0 -48
- package/libc/mingw/complex/cimag.c +0 -48
- package/libc/mingw/complex/cimagf.c +0 -48
- package/libc/mingw/complex/clog.c +0 -48
- package/libc/mingw/complex/clog10.c +0 -49
- package/libc/mingw/complex/clog10f.c +0 -49
- package/libc/mingw/complex/clogf.c +0 -48
- package/libc/mingw/complex/conj.c +0 -48
- package/libc/mingw/complex/conjf.c +0 -48
- package/libc/mingw/complex/cpow.c +0 -48
- package/libc/mingw/complex/cpowf.c +0 -48
- package/libc/mingw/complex/cproj.c +0 -48
- package/libc/mingw/complex/cprojf.c +0 -48
- package/libc/mingw/complex/creal.c +0 -48
- package/libc/mingw/complex/crealf.c +0 -48
- package/libc/mingw/complex/csin.c +0 -50
- package/libc/mingw/complex/csinf.c +0 -50
- package/libc/mingw/complex/csqrt.c +0 -48
- package/libc/mingw/complex/csqrtf.c +0 -48
- package/libc/mingw/complex/ctan.c +0 -50
- package/libc/mingw/complex/ctanf.c +0 -50
- package/libc/mingw/math/arm/s_rint.c +0 -86
- package/libc/mingw/math/arm/s_rintf.c +0 -51
- package/libc/mingw/math/arm/sincos.S +0 -30
- package/libc/mingw/math/arm-common/sincosl.c +0 -13
- package/libc/mingw/math/arm64/rint.c +0 -12
- package/libc/mingw/math/arm64/rintf.c +0 -12
- package/libc/mingw/math/arm64/sincos.S +0 -32
- package/libc/mingw/math/bsd_private_base.h +0 -148
- package/libc/mingw/math/fdiml.c +0 -24
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- package/libc/mingw/math/x86/acosf.c +0 -29
- package/libc/mingw/math/x86/atanf.c +0 -23
- package/libc/mingw/math/x86/atanl.c +0 -18
- package/libc/mingw/math/x86/cos.def.h +0 -65
- package/libc/mingw/math/x86/cosl.c +0 -46
- package/libc/mingw/math/x86/cosl_internal.S +0 -55
- package/libc/mingw/math/x86/ldexp.c +0 -23
- package/libc/mingw/math/x86/scalbn.S +0 -41
- package/libc/mingw/math/x86/scalbnf.S +0 -40
- package/libc/mingw/math/x86/sin.def.h +0 -65
- package/libc/mingw/math/x86/sinl.c +0 -46
- package/libc/mingw/math/x86/sinl_internal.S +0 -58
- package/libc/mingw/math/x86/tanl.S +0 -62
- package/libc/mingw/misc/btowc.c +0 -28
- package/libc/mingw/misc/wcstof.c +0 -66
- package/libc/mingw/misc/wcstoimax.c +0 -132
- package/libc/mingw/misc/wcstoumax.c +0 -126
- package/libc/mingw/misc/wctob.c +0 -29
- package/libc/mingw/misc/winbs_uint64.c +0 -6
- package/libc/mingw/misc/winbs_ulong.c +0 -6
- package/libc/mingw/misc/winbs_ushort.c +0 -6
- package/libc/mingw/stdio/_Exit.c +0 -10
- package/libc/mingw/stdio/_findfirst64i32.c +0 -21
- package/libc/mingw/stdio/_findnext64i32.c +0 -21
- package/libc/mingw/stdio/_fstat64i32.c +0 -37
- package/libc/mingw/stdio/_stat64i32.c +0 -37
- package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
- package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
- package/libc/mingw/stdio/_wstat64i32.c +0 -37
- package/libc/mingw/winpthreads/spinlock.c +0 -82
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/linux/tee.c +0 -8
- package/libc/musl/src/math/__cosl.c +0 -96
- package/libc/musl/src/math/__sinl.c +0 -78
- package/libc/musl/src/math/__tanl.c +0 -143
- package/libc/musl/src/math/aarch64/lrint.c +0 -10
- package/libc/musl/src/math/aarch64/lrintf.c +0 -10
- package/libc/musl/src/math/aarch64/rintf.c +0 -7
- package/libc/musl/src/math/cosl.c +0 -39
- package/libc/musl/src/math/fdim.c +0 -10
- package/libc/musl/src/math/fdimf.c +0 -10
- package/libc/musl/src/math/fdiml.c +0 -18
- package/libc/musl/src/math/finite.c +0 -7
- package/libc/musl/src/math/finitef.c +0 -7
- package/libc/musl/src/math/frexp.c +0 -23
- package/libc/musl/src/math/frexpf.c +0 -23
- package/libc/musl/src/math/frexpl.c +0 -29
- package/libc/musl/src/math/i386/lrint.c +0 -8
- package/libc/musl/src/math/i386/lrintf.c +0 -8
- package/libc/musl/src/math/i386/rintf.c +0 -7
- package/libc/musl/src/math/lrint.c +0 -72
- package/libc/musl/src/math/lrintf.c +0 -8
- package/libc/musl/src/math/powerpc64/lrint.c +0 -16
- package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
- package/libc/musl/src/math/rintf.c +0 -30
- package/libc/musl/src/math/s390x/rintf.c +0 -15
- package/libc/musl/src/math/sincosl.c +0 -60
- package/libc/musl/src/math/sinl.c +0 -41
- package/libc/musl/src/math/tanl.c +0 -29
- package/libc/musl/src/math/x32/lrint.s +0 -5
- package/libc/musl/src/math/x32/lrintf.s +0 -5
- package/libc/musl/src/math/x86_64/lrint.c +0 -8
- package/libc/musl/src/math/x86_64/lrintf.c +0 -8
- package/libc/musl/src/string/strdup.c +0 -10
- package/libc/musl/src/string/strndup.c +0 -12
- package/libc/musl/src/string/wcsdup.c +0 -10
- package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
- package/libc/musl/src/thread/pthread_spin_init.c +0 -6
- package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
- package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
- package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
- package/libc/musl/src/unistd/dup2.c +0 -20
- package/libc/musl/src/unistd/dup3.c +0 -26
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
- package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#define __SYSCALL_LL_E(x) (x)
|
|
2
2
|
#define __SYSCALL_LL_O(x) (x)
|
|
3
3
|
|
|
4
|
+
#define __scc(X) sizeof(1?(X):0ULL) < 8 ? (unsigned long) (X) : (long long) (X)
|
|
5
|
+
typedef long long syscall_arg_t;
|
|
6
|
+
|
|
4
7
|
#define SYSCALL_RLIM_INFINITY (-1UL/2)
|
|
5
8
|
|
|
6
9
|
#if __mips_isa_rev >= 6
|
|
@@ -13,9 +16,9 @@
|
|
|
13
16
|
"$14", "$15", "$24", "$25", "hi", "lo", "memory"
|
|
14
17
|
#endif
|
|
15
18
|
|
|
16
|
-
static inline long __syscall0(long n)
|
|
19
|
+
static inline long __syscall0(long long n)
|
|
17
20
|
{
|
|
18
|
-
register long r7 __asm__("$7");
|
|
21
|
+
register long long r7 __asm__("$7");
|
|
19
22
|
register long r2 __asm__("$2");
|
|
20
23
|
__asm__ __volatile__ (
|
|
21
24
|
"daddu $2,$0,%2 ; syscall"
|
|
@@ -25,10 +28,10 @@ static inline long __syscall0(long n)
|
|
|
25
28
|
return r7 && r2>0 ? -r2 : r2;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
static inline long __syscall1(long n, long a)
|
|
31
|
+
static inline long __syscall1(long long n, long long a)
|
|
29
32
|
{
|
|
30
|
-
register long r4 __asm__("$4") = a;
|
|
31
|
-
register long r7 __asm__("$7");
|
|
33
|
+
register long long r4 __asm__("$4") = a;
|
|
34
|
+
register long long r7 __asm__("$7");
|
|
32
35
|
register long r2 __asm__("$2");
|
|
33
36
|
__asm__ __volatile__ (
|
|
34
37
|
"daddu $2,$0,%2 ; syscall"
|
|
@@ -38,11 +41,11 @@ static inline long __syscall1(long n, long a)
|
|
|
38
41
|
return r7 && r2>0 ? -r2 : r2;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
static inline long __syscall2(long n, long a, long b)
|
|
44
|
+
static inline long __syscall2(long long n, long long a, long long b)
|
|
42
45
|
{
|
|
43
|
-
register long r4 __asm__("$4") = a;
|
|
44
|
-
register long r5 __asm__("$5") = b;
|
|
45
|
-
register long r7 __asm__("$7");
|
|
46
|
+
register long long r4 __asm__("$4") = a;
|
|
47
|
+
register long long r5 __asm__("$5") = b;
|
|
48
|
+
register long long r7 __asm__("$7");
|
|
46
49
|
register long r2 __asm__("$2");
|
|
47
50
|
|
|
48
51
|
__asm__ __volatile__ (
|
|
@@ -53,12 +56,12 @@ static inline long __syscall2(long n, long a, long b)
|
|
|
53
56
|
return r7 && r2>0 ? -r2 : r2;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
static inline long __syscall3(long n, long a, long b, long c)
|
|
59
|
+
static inline long __syscall3(long long n, long long a, long long b, long long c)
|
|
57
60
|
{
|
|
58
|
-
register long r4 __asm__("$4") = a;
|
|
59
|
-
register long r5 __asm__("$5") = b;
|
|
60
|
-
register long r6 __asm__("$6") = c;
|
|
61
|
-
register long r7 __asm__("$7");
|
|
61
|
+
register long long r4 __asm__("$4") = a;
|
|
62
|
+
register long long r5 __asm__("$5") = b;
|
|
63
|
+
register long long r6 __asm__("$6") = c;
|
|
64
|
+
register long long r7 __asm__("$7");
|
|
62
65
|
register long r2 __asm__("$2");
|
|
63
66
|
|
|
64
67
|
__asm__ __volatile__ (
|
|
@@ -69,12 +72,12 @@ static inline long __syscall3(long n, long a, long b, long c)
|
|
|
69
72
|
return r7 && r2>0 ? -r2 : r2;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
static inline long __syscall4(long n, long a, long b, long c, long d)
|
|
75
|
+
static inline long __syscall4(long long n, long long a, long long b, long long c, long long d)
|
|
73
76
|
{
|
|
74
|
-
register long r4 __asm__("$4") = a;
|
|
75
|
-
register long r5 __asm__("$5") = b;
|
|
76
|
-
register long r6 __asm__("$6") = c;
|
|
77
|
-
register long r7 __asm__("$7") = d;
|
|
77
|
+
register long long r4 __asm__("$4") = a;
|
|
78
|
+
register long long r5 __asm__("$5") = b;
|
|
79
|
+
register long long r6 __asm__("$6") = c;
|
|
80
|
+
register long long r7 __asm__("$7") = d;
|
|
78
81
|
register long r2 __asm__("$2");
|
|
79
82
|
|
|
80
83
|
__asm__ __volatile__ (
|
|
@@ -85,13 +88,13 @@ static inline long __syscall4(long n, long a, long b, long c, long d)
|
|
|
85
88
|
return r7 && r2>0 ? -r2 : r2;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
|
|
91
|
+
static inline long __syscall5(long long n, long long a, long long b, long long c, long long d, long long e)
|
|
89
92
|
{
|
|
90
|
-
register long r4 __asm__("$4") = a;
|
|
91
|
-
register long r5 __asm__("$5") = b;
|
|
92
|
-
register long r6 __asm__("$6") = c;
|
|
93
|
-
register long r7 __asm__("$7") = d;
|
|
94
|
-
register long r8 __asm__("$8") = e;
|
|
93
|
+
register long long r4 __asm__("$4") = a;
|
|
94
|
+
register long long r5 __asm__("$5") = b;
|
|
95
|
+
register long long r6 __asm__("$6") = c;
|
|
96
|
+
register long long r7 __asm__("$7") = d;
|
|
97
|
+
register long long r8 __asm__("$8") = e;
|
|
95
98
|
register long r2 __asm__("$2");
|
|
96
99
|
|
|
97
100
|
__asm__ __volatile__ (
|
|
@@ -102,14 +105,14 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)
|
|
|
102
105
|
return r7 && r2>0 ? -r2 : r2;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
|
|
108
|
+
static inline long __syscall6(long long n, long long a, long long b, long long c, long long d, long long e, long long f)
|
|
106
109
|
{
|
|
107
|
-
register long r4 __asm__("$4") = a;
|
|
108
|
-
register long r5 __asm__("$5") = b;
|
|
109
|
-
register long r6 __asm__("$6") = c;
|
|
110
|
-
register long r7 __asm__("$7") = d;
|
|
111
|
-
register long r8 __asm__("$8") = e;
|
|
112
|
-
register long r9 __asm__("$9") = f;
|
|
110
|
+
register long long r4 __asm__("$4") = a;
|
|
111
|
+
register long long r5 __asm__("$5") = b;
|
|
112
|
+
register long long r6 __asm__("$6") = c;
|
|
113
|
+
register long long r7 __asm__("$7") = d;
|
|
114
|
+
register long long r8 __asm__("$8") = e;
|
|
115
|
+
register long long r9 __asm__("$9") = f;
|
|
113
116
|
register long r2 __asm__("$2");
|
|
114
117
|
|
|
115
118
|
__asm__ __volatile__ (
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Double-precision x^y function.
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018, Arm Limited.
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include <math.h>
|
|
9
|
+
#include <stdint.h>
|
|
10
|
+
#include "libm.h"
|
|
11
|
+
#include "exp_data.h"
|
|
12
|
+
#include "pow_data.h"
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
Worst-case error: 0.54 ULP (~= ulperr_exp + 1024*Ln2*relerr_log*2^53)
|
|
16
|
+
relerr_log: 1.3 * 2^-68 (Relative error of log, 1.5 * 2^-68 without fma)
|
|
17
|
+
ulperr_exp: 0.509 ULP (ULP error of exp, 0.511 ULP without fma)
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#define T __pow_log_data.tab
|
|
21
|
+
#define A __pow_log_data.poly
|
|
22
|
+
#define Ln2hi __pow_log_data.ln2hi
|
|
23
|
+
#define Ln2lo __pow_log_data.ln2lo
|
|
24
|
+
#define N (1 << POW_LOG_TABLE_BITS)
|
|
25
|
+
#define OFF 0x3fe6955500000000
|
|
26
|
+
|
|
27
|
+
/* Top 12 bits of a double (sign and exponent bits). */
|
|
28
|
+
static inline uint32_t top12(double x)
|
|
29
|
+
{
|
|
30
|
+
return asuint64(x) >> 52;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Compute y+TAIL = log(x) where the rounded result is y and TAIL has about
|
|
34
|
+
additional 15 bits precision. IX is the bit representation of x, but
|
|
35
|
+
normalized in the subnormal range using the sign bit for the exponent. */
|
|
36
|
+
static inline double_t log_inline(uint64_t ix, double_t *tail)
|
|
37
|
+
{
|
|
38
|
+
/* double_t for better performance on targets with FLT_EVAL_METHOD==2. */
|
|
39
|
+
double_t z, r, y, invc, logc, logctail, kd, hi, t1, t2, lo, lo1, lo2, p;
|
|
40
|
+
uint64_t iz, tmp;
|
|
41
|
+
int k, i;
|
|
42
|
+
|
|
43
|
+
/* x = 2^k z; where z is in range [OFF,2*OFF) and exact.
|
|
44
|
+
The range is split into N subintervals.
|
|
45
|
+
The ith subinterval contains z and c is near its center. */
|
|
46
|
+
tmp = ix - OFF;
|
|
47
|
+
i = (tmp >> (52 - POW_LOG_TABLE_BITS)) % N;
|
|
48
|
+
k = (int64_t)tmp >> 52; /* arithmetic shift */
|
|
49
|
+
iz = ix - (tmp & 0xfffULL << 52);
|
|
50
|
+
z = asdouble(iz);
|
|
51
|
+
kd = (double_t)k;
|
|
52
|
+
|
|
53
|
+
/* log(x) = k*Ln2 + log(c) + log1p(z/c-1). */
|
|
54
|
+
invc = T[i].invc;
|
|
55
|
+
logc = T[i].logc;
|
|
56
|
+
logctail = T[i].logctail;
|
|
57
|
+
|
|
58
|
+
/* Note: 1/c is j/N or j/N/2 where j is an integer in [N,2N) and
|
|
59
|
+
|z/c - 1| < 1/N, so r = z/c - 1 is exactly representible. */
|
|
60
|
+
#if __FP_FAST_FMA
|
|
61
|
+
r = __builtin_fma(z, invc, -1.0);
|
|
62
|
+
#else
|
|
63
|
+
/* Split z such that rhi, rlo and rhi*rhi are exact and |rlo| <= |r|. */
|
|
64
|
+
double_t zhi = asdouble((iz + (1ULL << 31)) & (-1ULL << 32));
|
|
65
|
+
double_t zlo = z - zhi;
|
|
66
|
+
double_t rhi = zhi * invc - 1.0;
|
|
67
|
+
double_t rlo = zlo * invc;
|
|
68
|
+
r = rhi + rlo;
|
|
69
|
+
#endif
|
|
70
|
+
|
|
71
|
+
/* k*Ln2 + log(c) + r. */
|
|
72
|
+
t1 = kd * Ln2hi + logc;
|
|
73
|
+
t2 = t1 + r;
|
|
74
|
+
lo1 = kd * Ln2lo + logctail;
|
|
75
|
+
lo2 = t1 - t2 + r;
|
|
76
|
+
|
|
77
|
+
/* Evaluation is optimized assuming superscalar pipelined execution. */
|
|
78
|
+
double_t ar, ar2, ar3, lo3, lo4;
|
|
79
|
+
ar = A[0] * r; /* A[0] = -0.5. */
|
|
80
|
+
ar2 = r * ar;
|
|
81
|
+
ar3 = r * ar2;
|
|
82
|
+
/* k*Ln2 + log(c) + r + A[0]*r*r. */
|
|
83
|
+
#if __FP_FAST_FMA
|
|
84
|
+
hi = t2 + ar2;
|
|
85
|
+
lo3 = __builtin_fma(ar, r, -ar2);
|
|
86
|
+
lo4 = t2 - hi + ar2;
|
|
87
|
+
#else
|
|
88
|
+
double_t arhi = A[0] * rhi;
|
|
89
|
+
double_t arhi2 = rhi * arhi;
|
|
90
|
+
hi = t2 + arhi2;
|
|
91
|
+
lo3 = rlo * (ar + arhi);
|
|
92
|
+
lo4 = t2 - hi + arhi2;
|
|
93
|
+
#endif
|
|
94
|
+
/* p = log1p(r) - r - A[0]*r*r. */
|
|
95
|
+
p = (ar3 * (A[1] + r * A[2] +
|
|
96
|
+
ar2 * (A[3] + r * A[4] + ar2 * (A[5] + r * A[6]))));
|
|
97
|
+
lo = lo1 + lo2 + lo3 + lo4 + p;
|
|
98
|
+
y = hi + lo;
|
|
99
|
+
*tail = hi - y + lo;
|
|
100
|
+
return y;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
#undef N
|
|
104
|
+
#undef T
|
|
105
|
+
#define N (1 << EXP_TABLE_BITS)
|
|
106
|
+
#define InvLn2N __exp_data.invln2N
|
|
107
|
+
#define NegLn2hiN __exp_data.negln2hiN
|
|
108
|
+
#define NegLn2loN __exp_data.negln2loN
|
|
109
|
+
#define Shift __exp_data.shift
|
|
110
|
+
#define T __exp_data.tab
|
|
111
|
+
#define C2 __exp_data.poly[5 - EXP_POLY_ORDER]
|
|
112
|
+
#define C3 __exp_data.poly[6 - EXP_POLY_ORDER]
|
|
113
|
+
#define C4 __exp_data.poly[7 - EXP_POLY_ORDER]
|
|
114
|
+
#define C5 __exp_data.poly[8 - EXP_POLY_ORDER]
|
|
115
|
+
#define C6 __exp_data.poly[9 - EXP_POLY_ORDER]
|
|
116
|
+
|
|
117
|
+
/* Handle cases that may overflow or underflow when computing the result that
|
|
118
|
+
is scale*(1+TMP) without intermediate rounding. The bit representation of
|
|
119
|
+
scale is in SBITS, however it has a computed exponent that may have
|
|
120
|
+
overflown into the sign bit so that needs to be adjusted before using it as
|
|
121
|
+
a double. (int32_t)KI is the k used in the argument reduction and exponent
|
|
122
|
+
adjustment of scale, positive k here means the result may overflow and
|
|
123
|
+
negative k means the result may underflow. */
|
|
124
|
+
static inline double specialcase(double_t tmp, uint64_t sbits, uint64_t ki)
|
|
125
|
+
{
|
|
126
|
+
double_t scale, y;
|
|
127
|
+
|
|
128
|
+
if ((ki & 0x80000000) == 0) {
|
|
129
|
+
/* k > 0, the exponent of scale might have overflowed by <= 460. */
|
|
130
|
+
sbits -= 1009ull << 52;
|
|
131
|
+
scale = asdouble(sbits);
|
|
132
|
+
y = 0x1p1009 * (scale + scale * tmp);
|
|
133
|
+
return eval_as_double(y);
|
|
134
|
+
}
|
|
135
|
+
/* k < 0, need special care in the subnormal range. */
|
|
136
|
+
sbits += 1022ull << 52;
|
|
137
|
+
/* Note: sbits is signed scale. */
|
|
138
|
+
scale = asdouble(sbits);
|
|
139
|
+
y = scale + scale * tmp;
|
|
140
|
+
if (fabs(y) < 1.0) {
|
|
141
|
+
/* Round y to the right precision before scaling it into the subnormal
|
|
142
|
+
range to avoid double rounding that can cause 0.5+E/2 ulp error where
|
|
143
|
+
E is the worst-case ulp error outside the subnormal range. So this
|
|
144
|
+
is only useful if the goal is better than 1 ulp worst-case error. */
|
|
145
|
+
double_t hi, lo, one = 1.0;
|
|
146
|
+
if (y < 0.0)
|
|
147
|
+
one = -1.0;
|
|
148
|
+
lo = scale - y + scale * tmp;
|
|
149
|
+
hi = one + y;
|
|
150
|
+
lo = one - hi + y + lo;
|
|
151
|
+
y = eval_as_double(hi + lo) - one;
|
|
152
|
+
/* Fix the sign of 0. */
|
|
153
|
+
if (y == 0.0)
|
|
154
|
+
y = asdouble(sbits & 0x8000000000000000);
|
|
155
|
+
/* The underflow exception needs to be signaled explicitly. */
|
|
156
|
+
fp_force_eval(fp_barrier(0x1p-1022) * 0x1p-1022);
|
|
157
|
+
}
|
|
158
|
+
y = 0x1p-1022 * y;
|
|
159
|
+
return eval_as_double(y);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
#define SIGN_BIAS (0x800 << EXP_TABLE_BITS)
|
|
163
|
+
|
|
164
|
+
/* Computes sign*exp(x+xtail) where |xtail| < 2^-8/N and |xtail| <= |x|.
|
|
165
|
+
The sign_bias argument is SIGN_BIAS or 0 and sets the sign to -1 or 1. */
|
|
166
|
+
static inline double exp_inline(double_t x, double_t xtail, uint32_t sign_bias)
|
|
167
|
+
{
|
|
168
|
+
uint32_t abstop;
|
|
169
|
+
uint64_t ki, idx, top, sbits;
|
|
170
|
+
/* double_t for better performance on targets with FLT_EVAL_METHOD==2. */
|
|
171
|
+
double_t kd, z, r, r2, scale, tail, tmp;
|
|
172
|
+
|
|
173
|
+
abstop = top12(x) & 0x7ff;
|
|
174
|
+
if (predict_false(abstop - top12(0x1p-54) >=
|
|
175
|
+
top12(512.0) - top12(0x1p-54))) {
|
|
176
|
+
if (abstop - top12(0x1p-54) >= 0x80000000) {
|
|
177
|
+
/* Avoid spurious underflow for tiny x. */
|
|
178
|
+
/* Note: 0 is common input. */
|
|
179
|
+
double_t one = WANT_ROUNDING ? 1.0 + x : 1.0;
|
|
180
|
+
return sign_bias ? -one : one;
|
|
181
|
+
}
|
|
182
|
+
if (abstop >= top12(1024.0)) {
|
|
183
|
+
/* Note: inf and nan are already handled. */
|
|
184
|
+
if (asuint64(x) >> 63)
|
|
185
|
+
return __math_uflow(sign_bias);
|
|
186
|
+
else
|
|
187
|
+
return __math_oflow(sign_bias);
|
|
188
|
+
}
|
|
189
|
+
/* Large x is special cased below. */
|
|
190
|
+
abstop = 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)]. */
|
|
194
|
+
/* x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]. */
|
|
195
|
+
z = InvLn2N * x;
|
|
196
|
+
#if TOINT_INTRINSICS
|
|
197
|
+
kd = roundtoint(z);
|
|
198
|
+
ki = converttoint(z);
|
|
199
|
+
#elif EXP_USE_TOINT_NARROW
|
|
200
|
+
/* z - kd is in [-0.5-2^-16, 0.5] in all rounding modes. */
|
|
201
|
+
kd = eval_as_double(z + Shift);
|
|
202
|
+
ki = asuint64(kd) >> 16;
|
|
203
|
+
kd = (double_t)(int32_t)ki;
|
|
204
|
+
#else
|
|
205
|
+
/* z - kd is in [-1, 1] in non-nearest rounding modes. */
|
|
206
|
+
kd = eval_as_double(z + Shift);
|
|
207
|
+
ki = asuint64(kd);
|
|
208
|
+
kd -= Shift;
|
|
209
|
+
#endif
|
|
210
|
+
r = x + kd * NegLn2hiN + kd * NegLn2loN;
|
|
211
|
+
/* The code assumes 2^-200 < |xtail| < 2^-8/N. */
|
|
212
|
+
r += xtail;
|
|
213
|
+
/* 2^(k/N) ~= scale * (1 + tail). */
|
|
214
|
+
idx = 2 * (ki % N);
|
|
215
|
+
top = (ki + sign_bias) << (52 - EXP_TABLE_BITS);
|
|
216
|
+
tail = asdouble(T[idx]);
|
|
217
|
+
/* This is only a valid scale when -1023*N < k < 1024*N. */
|
|
218
|
+
sbits = T[idx + 1] + top;
|
|
219
|
+
/* exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1). */
|
|
220
|
+
/* Evaluation is optimized assuming superscalar pipelined execution. */
|
|
221
|
+
r2 = r * r;
|
|
222
|
+
/* Without fma the worst case error is 0.25/N ulp larger. */
|
|
223
|
+
/* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */
|
|
224
|
+
tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);
|
|
225
|
+
if (predict_false(abstop == 0))
|
|
226
|
+
return specialcase(tmp, sbits, ki);
|
|
227
|
+
scale = asdouble(sbits);
|
|
228
|
+
/* Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there
|
|
229
|
+
is no spurious underflow here even without fma. */
|
|
230
|
+
return eval_as_double(scale + scale * tmp);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/* Returns 0 if not int, 1 if odd int, 2 if even int. The argument is
|
|
234
|
+
the bit representation of a non-zero finite floating-point value. */
|
|
235
|
+
static inline int checkint(uint64_t iy)
|
|
236
|
+
{
|
|
237
|
+
int e = iy >> 52 & 0x7ff;
|
|
238
|
+
if (e < 0x3ff)
|
|
239
|
+
return 0;
|
|
240
|
+
if (e > 0x3ff + 52)
|
|
241
|
+
return 2;
|
|
242
|
+
if (iy & ((1ULL << (0x3ff + 52 - e)) - 1))
|
|
243
|
+
return 0;
|
|
244
|
+
if (iy & (1ULL << (0x3ff + 52 - e)))
|
|
245
|
+
return 1;
|
|
246
|
+
return 2;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Returns 1 if input is the bit representation of 0, infinity or nan. */
|
|
250
|
+
static inline int zeroinfnan(uint64_t i)
|
|
251
|
+
{
|
|
252
|
+
return 2 * i - 1 >= 2 * asuint64(INFINITY) - 1;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
double pow(double x, double y)
|
|
256
|
+
{
|
|
257
|
+
uint32_t sign_bias = 0;
|
|
258
|
+
uint64_t ix, iy;
|
|
259
|
+
uint32_t topx, topy;
|
|
260
|
+
|
|
261
|
+
ix = asuint64(x);
|
|
262
|
+
iy = asuint64(y);
|
|
263
|
+
topx = top12(x);
|
|
264
|
+
topy = top12(y);
|
|
265
|
+
if (predict_false(topx - 0x001 >= 0x7ff - 0x001 ||
|
|
266
|
+
(topy & 0x7ff) - 0x3be >= 0x43e - 0x3be)) {
|
|
267
|
+
/* Note: if |y| > 1075 * ln2 * 2^53 ~= 0x1.749p62 then pow(x,y) = inf/0
|
|
268
|
+
and if |y| < 2^-54 / 1075 ~= 0x1.e7b6p-65 then pow(x,y) = +-1. */
|
|
269
|
+
/* Special cases: (x < 0x1p-126 or inf or nan) or
|
|
270
|
+
(|y| < 0x1p-65 or |y| >= 0x1p63 or nan). */
|
|
271
|
+
if (predict_false(zeroinfnan(iy))) {
|
|
272
|
+
if (2 * iy == 0)
|
|
273
|
+
return issignaling_inline(x) ? x + y : 1.0;
|
|
274
|
+
if (ix == asuint64(1.0))
|
|
275
|
+
return issignaling_inline(y) ? x + y : 1.0;
|
|
276
|
+
if (2 * ix > 2 * asuint64(INFINITY) ||
|
|
277
|
+
2 * iy > 2 * asuint64(INFINITY))
|
|
278
|
+
return x + y;
|
|
279
|
+
if (2 * ix == 2 * asuint64(1.0))
|
|
280
|
+
return 1.0;
|
|
281
|
+
if ((2 * ix < 2 * asuint64(1.0)) == !(iy >> 63))
|
|
282
|
+
return 0.0; /* |x|<1 && y==inf or |x|>1 && y==-inf. */
|
|
283
|
+
return y * y;
|
|
284
|
+
}
|
|
285
|
+
if (predict_false(zeroinfnan(ix))) {
|
|
286
|
+
double_t x2 = x * x;
|
|
287
|
+
if (ix >> 63 && checkint(iy) == 1)
|
|
288
|
+
x2 = -x2;
|
|
289
|
+
/* Without the barrier some versions of clang hoist the 1/x2 and
|
|
290
|
+
thus division by zero exception can be signaled spuriously. */
|
|
291
|
+
return iy >> 63 ? fp_barrier(1 / x2) : x2;
|
|
292
|
+
}
|
|
293
|
+
/* Here x and y are non-zero finite. */
|
|
294
|
+
if (ix >> 63) {
|
|
295
|
+
/* Finite x < 0. */
|
|
296
|
+
int yint = checkint(iy);
|
|
297
|
+
if (yint == 0)
|
|
298
|
+
return __math_invalid(x);
|
|
299
|
+
if (yint == 1)
|
|
300
|
+
sign_bias = SIGN_BIAS;
|
|
301
|
+
ix &= 0x7fffffffffffffff;
|
|
302
|
+
topx &= 0x7ff;
|
|
303
|
+
}
|
|
304
|
+
if ((topy & 0x7ff) - 0x3be >= 0x43e - 0x3be) {
|
|
305
|
+
/* Note: sign_bias == 0 here because y is not odd. */
|
|
306
|
+
if (ix == asuint64(1.0))
|
|
307
|
+
return 1.0;
|
|
308
|
+
if ((topy & 0x7ff) < 0x3be) {
|
|
309
|
+
/* |y| < 2^-65, x^y ~= 1 + y*log(x). */
|
|
310
|
+
if (WANT_ROUNDING)
|
|
311
|
+
return ix > asuint64(1.0) ? 1.0 + y :
|
|
312
|
+
1.0 - y;
|
|
313
|
+
else
|
|
314
|
+
return 1.0;
|
|
315
|
+
}
|
|
316
|
+
return (ix > asuint64(1.0)) == (topy < 0x800) ?
|
|
317
|
+
__math_oflow(0) :
|
|
318
|
+
__math_uflow(0);
|
|
319
|
+
}
|
|
320
|
+
if (topx == 0) {
|
|
321
|
+
/* Normalize subnormal x so exponent becomes negative. */
|
|
322
|
+
ix = asuint64(x * 0x1p52);
|
|
323
|
+
ix &= 0x7fffffffffffffff;
|
|
324
|
+
ix -= 52ULL << 52;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
double_t lo;
|
|
329
|
+
double_t hi = log_inline(ix, &lo);
|
|
330
|
+
double_t ehi, elo;
|
|
331
|
+
#if __FP_FAST_FMA
|
|
332
|
+
ehi = y * hi;
|
|
333
|
+
elo = y * lo + __builtin_fma(y, hi, -ehi);
|
|
334
|
+
#else
|
|
335
|
+
double_t yhi = asdouble(iy & -1ULL << 27);
|
|
336
|
+
double_t ylo = y - yhi;
|
|
337
|
+
double_t lhi = asdouble(asuint64(hi) & -1ULL << 27);
|
|
338
|
+
double_t llo = hi - lhi + lo;
|
|
339
|
+
ehi = yhi * lhi;
|
|
340
|
+
elo = ylo * lhi + y * llo; /* |elo| < |ehi| * 2^-25. */
|
|
341
|
+
#endif
|
|
342
|
+
return exp_inline(ehi, elo, sign_bias);
|
|
343
|
+
}
|
package/package.json
CHANGED
package/std/Build/Cache.zig
CHANGED
|
@@ -562,14 +562,14 @@ pub const Manifest = struct {
|
|
|
562
562
|
self.diagnostic = .{ .manifest_create = error.FileNotFound };
|
|
563
563
|
return error.CacheCheckFailed;
|
|
564
564
|
},
|
|
565
|
-
error.Canceled => return
|
|
565
|
+
error.Canceled => |e| return e,
|
|
566
566
|
else => |e| {
|
|
567
567
|
self.diagnostic = .{ .manifest_create = e };
|
|
568
568
|
return error.CacheCheckFailed;
|
|
569
569
|
},
|
|
570
570
|
}
|
|
571
571
|
},
|
|
572
|
-
error.Canceled => return
|
|
572
|
+
error.Canceled => |e| return e,
|
|
573
573
|
else => |e| {
|
|
574
574
|
self.diagnostic = .{ .manifest_create = e };
|
|
575
575
|
return error.CacheCheckFailed;
|
|
@@ -675,7 +675,7 @@ pub const Manifest = struct {
|
|
|
675
675
|
var manifest_reader = self.manifest_file.?.reader(io, &tiny_buffer); // Reads positionally from zero.
|
|
676
676
|
const limit: std.Io.Limit = .limited(manifest_file_size_max);
|
|
677
677
|
const file_contents = manifest_reader.interface.allocRemaining(gpa, limit) catch |err| switch (err) {
|
|
678
|
-
error.OutOfMemory => return
|
|
678
|
+
error.OutOfMemory => |e| return e,
|
|
679
679
|
error.StreamTooLong => return error.OutOfMemory,
|
|
680
680
|
error.ReadFailed => {
|
|
681
681
|
self.diagnostic = .{ .manifest_read = manifest_reader.err.? };
|
|
@@ -767,7 +767,7 @@ pub const Manifest = struct {
|
|
|
767
767
|
// Every digest before this one has been populated successfully.
|
|
768
768
|
return .{ .miss = .{ .file_digests_populated = idx } };
|
|
769
769
|
},
|
|
770
|
-
error.Canceled => return
|
|
770
|
+
error.Canceled => |e| return e,
|
|
771
771
|
else => |e| {
|
|
772
772
|
self.diagnostic = .{ .file_open = .{
|
|
773
773
|
.file_index = idx,
|
|
@@ -880,14 +880,14 @@ pub const Manifest = struct {
|
|
|
880
880
|
.read = true,
|
|
881
881
|
.truncate = true,
|
|
882
882
|
}) catch |err| switch (err) {
|
|
883
|
-
error.Canceled => return
|
|
883
|
+
error.Canceled => |e| return e,
|
|
884
884
|
else => return true,
|
|
885
885
|
};
|
|
886
886
|
defer file.close(io);
|
|
887
887
|
|
|
888
888
|
// Save locally and also save globally (we still hold the global lock).
|
|
889
889
|
const stat = file.stat(io) catch |err| switch (err) {
|
|
890
|
-
error.Canceled => return
|
|
890
|
+
error.Canceled => |e| return e,
|
|
891
891
|
else => return true,
|
|
892
892
|
};
|
|
893
893
|
man.recent_problematic_timestamp = stat.mtime;
|
package/std/Build/Fuzz.zig
CHANGED
|
@@ -128,7 +128,7 @@ pub fn init(
|
|
|
128
128
|
|
|
129
129
|
pub fn start(fuzz: *Fuzz) void {
|
|
130
130
|
const io = fuzz.io;
|
|
131
|
-
fuzz.prog_node = fuzz.root_prog_node.start("Fuzzing",
|
|
131
|
+
fuzz.prog_node = fuzz.root_prog_node.start("Fuzzing", 0);
|
|
132
132
|
|
|
133
133
|
if (fuzz.mode == .forever) {
|
|
134
134
|
// For polling messages and sending updates to subscribers.
|
|
@@ -137,18 +137,8 @@ pub fn start(fuzz: *Fuzz) void {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
for (fuzz.run_steps) |run| {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// since they use the same Run step. See #30969
|
|
143
|
-
fatal("--fuzz not yet implemented for multiple tests", .{});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
for (fuzz.run_steps) |run| {
|
|
148
|
-
for (run.fuzz_tests.items) |unit_test_name| {
|
|
149
|
-
assert(run.rebuilt_executable != null);
|
|
150
|
-
fuzz.group.async(io, fuzzWorkerRun, .{ fuzz, run, unit_test_name });
|
|
151
|
-
}
|
|
140
|
+
assert(run.rebuilt_executable != null);
|
|
141
|
+
fuzz.group.async(io, fuzzWorkerRun, .{ fuzz, run });
|
|
152
142
|
}
|
|
153
143
|
}
|
|
154
144
|
|
|
@@ -193,16 +183,13 @@ fn rebuildTestsWorkerRunFallible(run: *Step.Run, gpa: Allocator, parent_prog_nod
|
|
|
193
183
|
run.rebuilt_executable = try rebuilt_bin_path.join(gpa, compile.out_filename);
|
|
194
184
|
}
|
|
195
185
|
|
|
196
|
-
fn fuzzWorkerRun(fuzz: *Fuzz, run: *Step.Run
|
|
186
|
+
fn fuzzWorkerRun(fuzz: *Fuzz, run: *Step.Run) void {
|
|
197
187
|
const owner = run.step.owner;
|
|
198
188
|
const gpa = owner.allocator;
|
|
199
189
|
const graph = owner.graph;
|
|
200
190
|
const io = graph.io;
|
|
201
191
|
|
|
202
|
-
|
|
203
|
-
defer prog_node.end();
|
|
204
|
-
|
|
205
|
-
run.rerunInFuzzMode(fuzz, unit_test_name, prog_node) catch |err| switch (err) {
|
|
192
|
+
run.rerunInFuzzMode(fuzz, fuzz.prog_node) catch |err| switch (err) {
|
|
206
193
|
error.MakeFailed => {
|
|
207
194
|
var buf: [256]u8 = undefined;
|
|
208
195
|
const stderr = io.lockStderr(&buf, graph.stderr_mode) catch |e| switch (e) {
|
|
@@ -213,7 +200,7 @@ fn fuzzWorkerRun(fuzz: *Fuzz, run: *Step.Run, unit_test_name: []const u8) void {
|
|
|
213
200
|
return;
|
|
214
201
|
},
|
|
215
202
|
else => {
|
|
216
|
-
log.err("step '{s}': failed to rerun
|
|
203
|
+
log.err("step '{s}': failed to rerun in fuzz mode: {t}", .{ run.step.name, err });
|
|
217
204
|
return;
|
|
218
205
|
},
|
|
219
206
|
};
|
package/std/Build/Module.zig
CHANGED
|
@@ -596,7 +596,7 @@ pub fn appendZigProcessFlags(
|
|
|
596
596
|
"-target", try target.query.zigTriple(b.allocator),
|
|
597
597
|
"-mcpu", try target.query.serializeCpuAlloc(b.allocator),
|
|
598
598
|
});
|
|
599
|
-
if (target.query.dynamic_linker)
|
|
599
|
+
if (target.query.dynamic_linker) |*dynamic_linker| {
|
|
600
600
|
if (dynamic_linker.get()) |dynamic_linker_path| {
|
|
601
601
|
try zig_args.append("--dynamic-linker");
|
|
602
602
|
try zig_args.append(dynamic_linker_path);
|
|
@@ -1814,16 +1814,16 @@ const ElfDumper = struct {
|
|
|
1814
1814
|
files.putAssumeCapacityNoClobber(object.off - @sizeOf(elf.ar_hdr), object.name);
|
|
1815
1815
|
}
|
|
1816
1816
|
|
|
1817
|
-
var symbols
|
|
1817
|
+
var symbols: std.array_hash_map.Auto(usize, std.array_list.Managed([]const u8)) = .empty;
|
|
1818
1818
|
defer {
|
|
1819
1819
|
for (symbols.values()) |*value| {
|
|
1820
1820
|
value.deinit();
|
|
1821
1821
|
}
|
|
1822
|
-
symbols.deinit();
|
|
1822
|
+
symbols.deinit(ctx.gpa);
|
|
1823
1823
|
}
|
|
1824
1824
|
|
|
1825
1825
|
for (ctx.symtab.items) |entry| {
|
|
1826
|
-
const gop = try symbols.getOrPut(@intCast(entry.off));
|
|
1826
|
+
const gop = try symbols.getOrPut(ctx.gpa, @intCast(entry.off));
|
|
1827
1827
|
if (!gop.found_existing) {
|
|
1828
1828
|
gop.value_ptr.* = std.array_list.Managed([]const u8).init(ctx.gpa);
|
|
1829
1829
|
}
|
|
@@ -219,6 +219,8 @@ generated_docs: ?*GeneratedFile,
|
|
|
219
219
|
generated_asm: ?*GeneratedFile,
|
|
220
220
|
generated_bin: ?*GeneratedFile,
|
|
221
221
|
generated_pdb: ?*GeneratedFile,
|
|
222
|
+
// hack for stage2_x86_64 + coff
|
|
223
|
+
generated_compiler_rt_dyn_lib: ?*GeneratedFile,
|
|
222
224
|
generated_implib: ?*GeneratedFile,
|
|
223
225
|
generated_llvm_bc: ?*GeneratedFile,
|
|
224
226
|
generated_llvm_ir: ?*GeneratedFile,
|
|
@@ -441,6 +443,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
|
|
|
441
443
|
.generated_asm = null,
|
|
442
444
|
.generated_bin = null,
|
|
443
445
|
.generated_pdb = null,
|
|
446
|
+
.generated_compiler_rt_dyn_lib = null,
|
|
444
447
|
.generated_implib = null,
|
|
445
448
|
.generated_llvm_bc = null,
|
|
446
449
|
.generated_llvm_ir = null,
|
|
@@ -691,6 +694,13 @@ pub fn producesPdbFile(compile: *Compile) bool {
|
|
|
691
694
|
return compile.isDynamicLibrary() or compile.kind == .exe or compile.kind == .@"test";
|
|
692
695
|
}
|
|
693
696
|
|
|
697
|
+
pub fn producesCompilerRtDynLib(compile: *Compile) bool {
|
|
698
|
+
if (compile.rootModuleTarget().ofmt != .coff) return false;
|
|
699
|
+
if (compile.bundle_compiler_rt orelse (compile.kind == .exe or compile.isDynamicLibrary()))
|
|
700
|
+
return compile.use_llvm == false;
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
|
|
694
704
|
pub fn producesImplib(compile: *Compile) bool {
|
|
695
705
|
return compile.isDll();
|
|
696
706
|
}
|
|
@@ -869,6 +879,12 @@ pub fn getEmittedPdb(compile: *Compile) LazyPath {
|
|
|
869
879
|
return compile.getEmittedFileGeneric(&compile.generated_pdb);
|
|
870
880
|
}
|
|
871
881
|
|
|
882
|
+
/// Returns the generated compiler_rt dynamic library.
|
|
883
|
+
/// This is a hack for stage2_x86_64 + coff.
|
|
884
|
+
pub fn getEmittedCompilerRtDynLib(compile: *Compile) ?LazyPath {
|
|
885
|
+
return compile.getEmittedFileGeneric(&compile.generated_compiler_rt_dyn_lib);
|
|
886
|
+
}
|
|
887
|
+
|
|
872
888
|
/// Returns the path to the generated documentation directory.
|
|
873
889
|
pub fn getEmittedDocs(compile: *Compile) LazyPath {
|
|
874
890
|
return compile.getEmittedFileGeneric(&compile.generated_docs);
|
|
@@ -1377,7 +1393,6 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
|
|
|
1377
1393
|
try zig_args.append("--debug-incremental");
|
|
1378
1394
|
}
|
|
1379
1395
|
|
|
1380
|
-
if (b.verbose_cimport) try zig_args.append("--verbose-cimport");
|
|
1381
1396
|
if (b.verbose_air) try zig_args.append("--verbose-air");
|
|
1382
1397
|
if (b.verbose_llvm_ir) |path| try zig_args.append(b.fmt("--verbose-llvm-ir={s}", .{path}));
|
|
1383
1398
|
if (b.verbose_llvm_bc) |path| try zig_args.append(b.fmt("--verbose-llvm-bc={s}", .{path}));
|
|
@@ -1794,6 +1809,8 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
|
|
|
1794
1809
|
// zig fmt: off
|
|
1795
1810
|
if (compile.generated_bin) |lp| lp.path = compile.outputPath(output_dir, .bin);
|
|
1796
1811
|
if (compile.generated_pdb) |lp| lp.path = compile.outputPath(output_dir, .pdb);
|
|
1812
|
+
// hack for stage2_x86_64 + coff
|
|
1813
|
+
if (compile.generated_compiler_rt_dyn_lib) |lp| lp.path = compile.outputPath(output_dir, .compiler_rt_dyn_lib);
|
|
1797
1814
|
if (compile.generated_implib) |lp| lp.path = compile.outputPath(output_dir, .implib);
|
|
1798
1815
|
if (compile.generated_h) |lp| lp.path = compile.outputPath(output_dir, .h);
|
|
1799
1816
|
if (compile.generated_docs) |lp| lp.path = compile.outputPath(output_dir, .docs);
|