Fix bugs and have emulator emulate itself

This commit is contained in:
Justine Tunney 2020-08-31 05:17:31 -07:00
parent 5aabacb361
commit bd29223891
111 changed files with 1283 additions and 2073 deletions

View file

@ -18,16 +18,16 @@
02110-1301 USA
*/
#include "libc/intrin/shufpd.h"
#include "libc/str/str.h"
/**
* Shuffles double vector.
* @param 𝑚 needs to be a literal, constexpr, or embedding
* @mayalias
*/
void(shufpd)(double b[2], const double a[2], uint8_t m) {
void(shufpd)(double c[2], const double b[2], const double a[2], uint8_t m) {
double t[2];
t[0] = a[(m & 0b0000001) >> 0];
t[1] = a[(m & 0b0000010) >> 1];
b[0] = t[0];
b[1] = t[1];
t[1] = b[(m & 0b0000010) >> 1];
memcpy(c, t, 16);
}

View file

@ -3,7 +3,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void shufpd(double[2], const double[2], uint8_t);
void shufpd(double[2], const double[2], const double[2], uint8_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -18,20 +18,18 @@
02110-1301 USA
*/
#include "libc/intrin/shufps.h"
#include "libc/str/str.h"
/**
* Shuffles float vector.
* @param 𝑚 needs to be a literal, constexpr, or embedding
* @mayalias
*/
void(shufps)(float b[4], const float a[4], uint8_t m) {
void(shufps)(float c[4], const float b[4], const float a[4], uint8_t m) {
float t[4];
t[0] = a[(m & 0b00000011) >> 0];
t[1] = a[(m & 0b00001100) >> 2];
t[0] = b[(m & 0b00000011) >> 0];
t[1] = b[(m & 0b00001100) >> 2];
t[2] = a[(m & 0b00110000) >> 4];
t[3] = a[(m & 0b11000000) >> 6];
b[0] = t[0];
b[1] = t[1];
b[2] = t[2];
b[3] = t[3];
memcpy(c, t, 16);
}

View file

@ -3,7 +3,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void shufps(float[4], const float[4], uint8_t);
void shufps(float[4], const float[4], const float[4], uint8_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */