mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Make progress towards aarch64 build
This commit is contained in:
parent
08ff26c817
commit
ca2860947f
15428 changed files with 25694 additions and 23138 deletions
|
@ -43,6 +43,7 @@ static dontinline antiquity void bzero_sse(char *p, size_t n) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
microarchitecture("avx") static void bzero_avx(char *p, size_t n) {
|
||||
xmm_t v = {0};
|
||||
if (IsAsan()) __asan_verify(p, n);
|
||||
|
@ -73,6 +74,7 @@ microarchitecture("avx") static void bzero_avx(char *p, size_t n) {
|
|||
*(xmm_t *)p = v;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Sets memory to zero.
|
||||
|
@ -134,7 +136,11 @@ void bzero(void *p, size_t n) {
|
|||
char *b;
|
||||
uint64_t x;
|
||||
b = p;
|
||||
#ifdef __x86_64__
|
||||
asm("xorl\t%k0,%k0" : "=r"(x));
|
||||
#else
|
||||
x = 0;
|
||||
#endif
|
||||
if (n <= 16) {
|
||||
if (n >= 8) {
|
||||
__builtin_memcpy(b, &x, 8);
|
||||
|
@ -148,11 +154,13 @@ void bzero(void *p, size_t n) {
|
|||
b[--n] = x;
|
||||
} while (n);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
} else if (IsTiny()) {
|
||||
asm("rep stosb" : "+D"(b), "+c"(n), "=m"(*(char(*)[n])b) : "a"(0));
|
||||
return;
|
||||
} else if (X86_HAVE(AVX)) {
|
||||
bzero_avx(b, n);
|
||||
#endif
|
||||
} else {
|
||||
bzero_sse(b, n);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue