diff --git a/code/vadda_b.cpp b/code/vadda_b.cpp new file mode 100644 index 00000000..f1d86462 --- /dev/null +++ b/code/vadda_b.cpp @@ -0,0 +1,9 @@ +#include "common.h" + +v128 vadda_b(v128 a, v128 b) { + v128 dst; +#include "vadda_b.h" + return dst; +} + +void test() { FUZZ2(vadda_b); } diff --git a/code/vadda_b.h b/code/vadda_b.h index dae37a17..46159449 100644 --- a/code/vadda_b.h +++ b/code/vadda_b.h @@ -1,3 +1,3 @@ for (int i = 0; i < 16; i++) { - dst.byte[i] = abs(a.byte[i]) + abs(b.byte[i]); + dst.byte[i] = abs((s8)a.byte[i]) + abs((s8)b.byte[i]); } diff --git a/code/vadda_d.cpp b/code/vadda_d.cpp new file mode 100644 index 00000000..ba1405c6 --- /dev/null +++ b/code/vadda_d.cpp @@ -0,0 +1,9 @@ +#include "common.h" + +v128 vadda_d(v128 a, v128 b) { + v128 dst; +#include "vadda_d.h" + return dst; +} + +void test() { FUZZ2(vadda_d); } diff --git a/code/vadda_d.h b/code/vadda_d.h index 7cd9a55b..72e48397 100644 --- a/code/vadda_d.h +++ b/code/vadda_d.h @@ -1,4 +1,4 @@ for (int i = 0; i < 2; i++) { - dst.dword[i] = abs(a.dword[i]) + abs(b.dword[i]); + dst.dword[i] = abs((s64)a.dword[i]) + abs((s64)b.dword[i]); } diff --git a/code/vadda_h.cpp b/code/vadda_h.cpp new file mode 100644 index 00000000..d9216b91 --- /dev/null +++ b/code/vadda_h.cpp @@ -0,0 +1,10 @@ +#include "common.h" + +v128 vadda_h(v128 a, v128 b) { + v128 dst; +#include "vadda_h.h" + return dst; +} + +void test() { FUZZ2(vadda_h); } + diff --git a/code/vadda_h.h b/code/vadda_h.h index 1085bfcc..6e6f3762 100644 --- a/code/vadda_h.h +++ b/code/vadda_h.h @@ -1,4 +1,4 @@ for (int i = 0; i < 8; i++) { - dst.half[i] = abs(a.half[i]) + abs(b.half[i]); + dst.half[i] = abs((s16)a.half[i]) + abs((s16)b.half[i]); } diff --git a/code/vadda_w.cpp b/code/vadda_w.cpp new file mode 100644 index 00000000..3e7ad2c2 --- /dev/null +++ b/code/vadda_w.cpp @@ -0,0 +1,10 @@ +#include "common.h" + +v128 vadda_w(v128 a, v128 b) { + v128 dst; +#include "vadda_w.h" + return dst; +} + +void test() { FUZZ2(vadda_w); } + diff --git a/code/vadda_w.h b/code/vadda_w.h index 1fc815d3..a99972c4 100644 --- a/code/vadda_w.h +++ b/code/vadda_w.h @@ -1,3 +1,3 @@ for (int i = 0; i < 4; i++) { - dst.word[i] = abs(a.word[i]) + abs(b.word[i]); + dst.word[i] = abs((s32)a.word[i]) + abs((s32)b.word[i]); } diff --git a/main.py b/main.py index e34e5c23..4f7b38e5 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ import math +import os def define_env(env): widths = { @@ -30,6 +31,10 @@ def include(file): def instruction(intrinsic, instr, desc): file_name = instr.split(" ")[0].replace(".", "_") + if os.path.exists(f"code/{file_name}.cpp"): + tested = "Tested on real machine." + else: + tested = "" return f""" ## {intrinsic} @@ -51,6 +56,9 @@ def instruction(intrinsic, instr, desc): ```c++ {include(f'{file_name}.h')} ``` + +{tested} + """ @env.macro