mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 17:28:30 +00:00
Add some more builtins to chibicc
https://justine.lol/cosmopolitan/documentation.html should now contain a lot of functions that had been missing previously due to not having them
This commit is contained in:
parent
ab38f0823d
commit
f1dfa4bdfa
17 changed files with 417 additions and 201 deletions
40
third_party/chibicc/test/vector_test.c
vendored
40
third_party/chibicc/test/vector_test.c
vendored
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/chibicc/test/test.h"
|
||||
|
||||
typedef char byte16 __attribute__((__vector_size__(16)));
|
||||
typedef float float4 __attribute__((__vector_size__(16)));
|
||||
typedef float float4a1 __attribute__((__vector_size__(16), __aligned__(1)));
|
||||
typedef float float4a16 __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
|
@ -39,18 +40,33 @@ int main(void) {
|
|||
ASSERT(1, _Alignof(double2a1));
|
||||
ASSERT(16, _Alignof(double2a16));
|
||||
|
||||
float4 v1;
|
||||
float4 v2;
|
||||
float x[4] = {1, 2, 3, 4};
|
||||
float y[4] = {1, 1, 1, 1};
|
||||
memcpy(&v1, x, 16);
|
||||
memcpy(&v2, y, 16);
|
||||
v1 = v1 + v2;
|
||||
memcpy(x, &v1, 16);
|
||||
ASSERT(2, x[0]);
|
||||
/* ASSERT(3, x[1]); */
|
||||
/* ASSERT(4, x[2]); */
|
||||
/* ASSERT(5, x[3]); */
|
||||
{
|
||||
float4 v1;
|
||||
float4 v2;
|
||||
float x[4] = {1, 2, 3, 4};
|
||||
float y[4] = {1, 1, 1, 1};
|
||||
memcpy(&v1, x, 16);
|
||||
memcpy(&v2, y, 16);
|
||||
v1 = v1 + v2;
|
||||
memcpy(x, &v1, 16);
|
||||
ASSERT(2, x[0]);
|
||||
// TODO(jart): fix me
|
||||
/* ASSERT(3, x[1]); */
|
||||
/* ASSERT(4, x[2]); */
|
||||
/* ASSERT(5, x[3]); */
|
||||
}
|
||||
|
||||
{
|
||||
byte16 v;
|
||||
float x1[4] = {1, 2, 3, 4};
|
||||
float x2[4];
|
||||
memcpy(&v, x1, 16);
|
||||
__builtin_ia32_movntdq(x1, &v);
|
||||
memcpy(x2, &v, 16);
|
||||
ASSERT(1, x2[0]);
|
||||
// TODO(jart): fix me
|
||||
/* ASSERT(2, x[1]); */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue