mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 09:18:31 +00:00
Make fixes, improvements, and chibicc python bindings
- python now mixes audio 10x faster - python octal notation is restored - chibicc now builds code 3x faster - chibicc now has help documentation - chibicc can now generate basic python bindings - linenoise now supports some paredit-like features See #141
This commit is contained in:
parent
28997f3acb
commit
7061c79c22
121 changed files with 5272 additions and 1928 deletions
|
@ -29,8 +29,8 @@ static noinline antiquity int memcmp_sse(const unsigned char *p,
|
|||
unsigned u, u0, u1, u2, u3;
|
||||
if (n > 32) {
|
||||
while (n > 16 + 16) {
|
||||
if (!(u = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
*(const xmm_t *)p, *(const xmm_t *)q)) -
|
||||
if (!(u = __builtin_ia32_pmovmskb128(*(const xmm_t *)p ==
|
||||
*(const xmm_t *)q) -
|
||||
0xffff)) {
|
||||
n -= 16;
|
||||
p += 16;
|
||||
|
@ -41,11 +41,10 @@ static noinline antiquity int memcmp_sse(const unsigned char *p,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!(u = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
*(const xmm_t *)p, *(const xmm_t *)q)) -
|
||||
if (!(u = __builtin_ia32_pmovmskb128(*(const xmm_t *)p == *(const xmm_t *)q) -
|
||||
0xffff)) {
|
||||
if (!(u = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
*(const xmm_t *)(p + n - 16), *(const xmm_t *)(q + n - 16))) -
|
||||
if (!(u = __builtin_ia32_pmovmskb128(*(const xmm_t *)(p + n - 16) ==
|
||||
*(const xmm_t *)(q + n - 16)) -
|
||||
0xffff)) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -65,14 +64,14 @@ microarchitecture("avx") static int memcmp_avx(const unsigned char *p,
|
|||
unsigned u, u0, u1, u2, u3;
|
||||
if (n > 32) {
|
||||
while (n >= 16 + 64) {
|
||||
u0 = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
((const xmm_t *)p)[0], ((const xmm_t *)q)[0]));
|
||||
u1 = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
((const xmm_t *)p)[1], ((const xmm_t *)q)[1]));
|
||||
u2 = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
((const xmm_t *)p)[2], ((const xmm_t *)q)[2]));
|
||||
u3 = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
((const xmm_t *)p)[3], ((const xmm_t *)q)[3]));
|
||||
u0 = __builtin_ia32_pmovmskb128(
|
||||
(((const xmm_t *)p)[0] == ((const xmm_t *)q)[0]));
|
||||
u1 = __builtin_ia32_pmovmskb128(
|
||||
(((const xmm_t *)p)[1] == ((const xmm_t *)q)[1]));
|
||||
u2 = __builtin_ia32_pmovmskb128(
|
||||
(((const xmm_t *)p)[2] == ((const xmm_t *)q)[2]));
|
||||
u3 = __builtin_ia32_pmovmskb128(
|
||||
(((const xmm_t *)p)[3] == ((const xmm_t *)q)[3]));
|
||||
w = (uint64_t)u0 | (uint64_t)u1 << 16 | (uint64_t)u2 << 32 |
|
||||
(uint64_t)u3 << 48;
|
||||
if (w == -1) {
|
||||
|
@ -85,8 +84,8 @@ microarchitecture("avx") static int memcmp_avx(const unsigned char *p,
|
|||
}
|
||||
}
|
||||
while (n > 16 + 16) {
|
||||
if (!(u = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
*(const xmm_t *)p, *(const xmm_t *)q)) -
|
||||
if (!(u = __builtin_ia32_pmovmskb128(*(const xmm_t *)p ==
|
||||
*(const xmm_t *)q) -
|
||||
0xffff)) {
|
||||
n -= 16;
|
||||
p += 16;
|
||||
|
@ -97,11 +96,10 @@ microarchitecture("avx") static int memcmp_avx(const unsigned char *p,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!(u = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
*(const xmm_t *)p, *(const xmm_t *)q)) -
|
||||
if (!(u = __builtin_ia32_pmovmskb128(*(const xmm_t *)p == *(const xmm_t *)q) -
|
||||
0xffff)) {
|
||||
if (!(u = __builtin_ia32_pmovmskb128(__builtin_ia32_pcmpeqb128(
|
||||
*(const xmm_t *)(p + n - 16), *(const xmm_t *)(q + n - 16))) -
|
||||
if (!(u = __builtin_ia32_pmovmskb128(*(const xmm_t *)(p + n - 16) ==
|
||||
*(const xmm_t *)(q + n - 16)) -
|
||||
0xffff)) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -149,7 +147,8 @@ int memcmp(const void *a, const void *b, size_t n) {
|
|||
uint32_t k, i, j;
|
||||
uint64_t w, x, y;
|
||||
const unsigned char *p, *q;
|
||||
if ((p = a) == (q = b)) return 0;
|
||||
if ((p = a) == (q = b) || !n) return 0;
|
||||
if ((c = *p - *q)) return c;
|
||||
if (!IsTiny()) {
|
||||
if (n <= 16) {
|
||||
if (n >= 8) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue