Make AARCH64 harder, better, faster, stronger

- Perform some housekeeping on scalar math function code
- Import ARM's Optimized Routines for SIMD string processing
- Upgrade to latest Chromium zlib and enable more SIMD optimizations
This commit is contained in:
Justine Tunney 2023-05-15 01:51:29 -07:00
parent 550b52abf6
commit cc1732bc42
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
143 changed files with 15661 additions and 1329 deletions

View file

@ -36,10 +36,16 @@ STATIC_YOINK("strerror_wr");
/**
* Handles failure of CHECK_xx() macros.
*/
relegated void __check_fail(const char *suffix, const char *opstr,
uint64_t want, const char *wantstr, uint64_t got,
const char *gotstr, const char *file, int line,
const char *fmt, ...) {
relegated void __check_fail(const char *suffix, //
const char *opstr, //
uint64_t want, //
const char *wantstr, //
uint64_t got, //
const char *gotstr, //
const char *file, //
int line, //
const char *fmt, //
...) {
int e;
char *p;
size_t i;

View file

@ -33,21 +33,69 @@
*
* @see libc/log/thunks/__check_fail_ndebug.S
*/
relegated wontreturn void __check_fail_ndebug(uint64_t want, uint64_t got,
const char *file, int line,
const char *opchar,
const char *fmt, ...) {
va_list va;
static relegated wontreturn void __check_fail_ndebug(uint64_t want, //
uint64_t got, //
const char *file, //
int line, //
const char *opchar, //
const char *fmt, //
va_list va) {
__restore_tty();
kprintf("%rerror:%s:%d: check failed: %'ld %s %'ld% m", file, line, want,
opchar, got);
if (*fmt) {
if (fmt && *fmt) {
kprintf(": ");
va_start(va, fmt);
kvprintf(fmt, va);
va_end(va);
}
kprintf("\n");
if (_weaken(__die)) _weaken(__die)();
_Exitr(68);
}
void __check_fail_eq(uint64_t want, uint64_t got, const char *file, int line,
const char *opchar, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
__check_fail_ndebug(want, got, file, line, opchar, fmt, va);
va_end(va);
}
void __check_fail_ne(uint64_t want, uint64_t got, const char *file, int line,
const char *opchar, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
__check_fail_ndebug(want, got, file, line, opchar, fmt, va);
va_end(va);
}
void __check_fail_le(uint64_t want, uint64_t got, const char *file, int line,
const char *opchar, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
__check_fail_ndebug(want, got, file, line, opchar, fmt, va);
va_end(va);
}
void __check_fail_lt(uint64_t want, uint64_t got, const char *file, int line,
const char *opchar, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
__check_fail_ndebug(want, got, file, line, opchar, fmt, va);
va_end(va);
}
void __check_fail_ge(uint64_t want, uint64_t got, const char *file, int line,
const char *opchar, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
__check_fail_ndebug(want, got, file, line, opchar, fmt, va);
va_end(va);
}
void __check_fail_gt(uint64_t want, uint64_t got, const char *file, int line,
const char *opchar, const char *fmt, ...) {
va_list va;
va_start(va, fmt);
__check_fail_ndebug(want, got, file, line, opchar, fmt, va);
va_end(va);
}

View file

@ -6,9 +6,7 @@ PKGS += LIBC_LOG
LIBC_LOG_ARTIFACTS += LIBC_LOG_A
LIBC_LOG = $(LIBC_LOG_A_DEPS) $(LIBC_LOG_A)
LIBC_LOG_A = o/$(MODE)/libc/log/log.a
LIBC_LOG_A_FILES := \
$(wildcard libc/log/thunks/*) \
$(wildcard libc/log/*)
LIBC_LOG_A_FILES := $(wildcard libc/log/*)
LIBC_LOG_A_HDRS = $(filter %.h,$(LIBC_LOG_A_FILES))
LIBC_LOG_A_SRCS_C = $(filter %.c,$(LIBC_LOG_A_FILES))
LIBC_LOG_A_SRCS_S = $(filter %.S,$(LIBC_LOG_A_FILES))

View file

@ -1,30 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.text.unlikely
// Code-size saving thunk for CHECK_EQ() in NDEBUG mode.
__check_fail_eq:
lea .Lop(%rip),%r8
jmp __check_fail_ndebug
.endfn __check_fail_eq,globl
.rodata.str1.1
.Lop: .asciz "=="
.previous

View file

@ -1,30 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.text.unlikely
// Code-size saving thunk for CHECK_GE() in NDEBUG mode.
__check_fail_ge:
lea .Lop(%rip),%r8
jmp __check_fail_ndebug
.endfn __check_fail_ge,globl
.rodata.str1.1
.Lop: .asciz ">="
.previous

View file

@ -1,30 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.text.unlikely
// Code-size saving thunk for CHECK_GT() in NDEBUG mode.
__check_fail_gt:
lea .Lop(%rip),%r8
jmp __check_fail_ndebug
.endfn __check_fail_gt,globl
.rodata.str1.1
.Lop: .asciz ">"
.previous

View file

@ -1,30 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.text.unlikely
// Code-size saving thunk for CHECK_LE() in NDEBUG mode.
__check_fail_le:
lea .Lop(%rip),%r8
jmp __check_fail_ndebug
.endfn __check_fail_le,globl
.rodata.str1.1
.Lop: .asciz "<="
.previous

View file

@ -1,30 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.text.unlikely
// Code-size saving thunk for CHECK_LT() in NDEBUG mode.
__check_fail_lt:
lea .Lop(%rip),%r8
jmp __check_fail_ndebug
.endfn __check_fail_lt,globl
.rodata.str1.1
.Lop: .asciz "<"
.previous

View file

@ -1,30 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.text.unlikely
// Code-size saving thunk for CHECK_NE() in NDEBUG mode.
__check_fail_ne:
lea .Lop(%rip),%r8
jmp __check_fail_ndebug
.endfn __check_fail_ne,globl
.rodata.str1.1
.Lop: .asciz "!="
.previous