Skip to content

Commit

Permalink
Add missing tests, fix vfcvt_s_d description
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 14, 2023
1 parent ed07aa5 commit f386dfc
Show file tree
Hide file tree
Showing 27 changed files with 1,395 additions and 317 deletions.
1,238 changes: 1,041 additions & 197 deletions code/measure.h

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions code/untested.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
src = f.replace(".h", ".cpp")
if os.path.exists(src):
# make sure we are testing the expected instruction
if src.split(".")[0] not in open(src, "r").read():
# intrinsic's name is different from instruction's name
if src.startswith("vset") or src.startswith("vset"):
continue
content = open(src, "r").read()
name = src.split(".")[0]
if name not in content or f'#include "{name}.h"' not in content:
print("Bad test:", src)
if not os.path.exists(src):
if (
Expand Down
19 changes: 0 additions & 19 deletions code/vfcmp.cpp

This file was deleted.

Empty file removed code/vfcmp.h
Empty file.
23 changes: 0 additions & 23 deletions code/vfmadd.cpp

This file was deleted.

23 changes: 0 additions & 23 deletions code/vfmsub.cpp

This file was deleted.

23 changes: 0 additions & 23 deletions code/vfnmadd.cpp

This file was deleted.

23 changes: 0 additions & 23 deletions code/vfnmsub.cpp

This file was deleted.

11 changes: 11 additions & 0 deletions code/vsetallnez_b.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bnz_b(v128 a) {
int dst;
#include "vsetallnez_b.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(!__lsx_bnz_b(a));
assert(__lsx_bnz_b(a) == bnz_b(a));

a = __m128i{1, 0};
assert(!__lsx_bnz_b(a));
assert(__lsx_bnz_b(a) == bnz_b(a));

a = __m128i{0, 1};
assert(!__lsx_bnz_b(a));
assert(__lsx_bnz_b(a) == bnz_b(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(__lsx_bnz_b(a));
assert(__lsx_bnz_b(a) == bnz_b(a));

a = __m128i{0x1111111111111100, 0x1111111111111111};
assert(!__lsx_bnz_b(a));
assert(__lsx_bnz_b(a) == bnz_b(a));
}
13 changes: 12 additions & 1 deletion code/vsetallnez_d.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bnz_d(v128 a) {
int dst;
#include "vsetallnez_d.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(!__lsx_bnz_d(a));
assert(__lsx_bnz_d(a) == bnz_d(a));

a = __m128i{1, 0};
assert(!__lsx_bnz_d(a));
assert(__lsx_bnz_d(a) == bnz_d(a));

a = __m128i{0, 1};
assert(!__lsx_bnz_d(a));
assert(__lsx_bnz_d(a) == bnz_d(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(__lsx_bnz_d(a));
assert(__lsx_bnz_d(a) == bnz_d(a));

a = __m128i{0x0, 0x1111111111111111};
a = __m128i{0x0000000000000000, 0x1111111111111111};
assert(!__lsx_bnz_d(a));
assert(__lsx_bnz_d(a) == bnz_d(a));
}
11 changes: 11 additions & 0 deletions code/vsetallnez_h.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bnz_h(v128 a) {
int dst;
#include "vsetallnez_h.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(!__lsx_bnz_h(a));
assert(__lsx_bnz_h(a) == bnz_h(a));

a = __m128i{1, 0};
assert(!__lsx_bnz_h(a));
assert(__lsx_bnz_h(a) == bnz_h(a));

a = __m128i{0, 1};
assert(!__lsx_bnz_h(a));
assert(__lsx_bnz_h(a) == bnz_h(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(__lsx_bnz_h(a));
assert(__lsx_bnz_h(a) == bnz_h(a));

a = __m128i{0x1111111111110000, 0x1111111111111111};
assert(!__lsx_bnz_h(a));
assert(__lsx_bnz_h(a) == bnz_h(a));
}
13 changes: 12 additions & 1 deletion code/vsetallnez_w.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bnz_w(v128 a) {
int dst;
#include "vsetallnez_w.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(!__lsx_bnz_w(a));
assert(__lsx_bnz_w(a) == bnz_w(a));

a = __m128i{1, 0};
assert(!__lsx_bnz_w(a));
assert(__lsx_bnz_w(a) == bnz_w(a));

a = __m128i{0, 1};
assert(!__lsx_bnz_w(a));
assert(__lsx_bnz_w(a) == bnz_w(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(__lsx_bnz_w(a));
assert(__lsx_bnz_w(a) == bnz_w(a));

a = __m128i{0x1111111100000000, 0x1111111111111111};
a = __m128i{0x1111111111111100, 0x1111111111111111};
assert(!__lsx_bnz_w(a));
assert(__lsx_bnz_w(a) == bnz_w(a));
}
11 changes: 11 additions & 0 deletions code/vsetanyeqz_b.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bz_b(v128 a) {
int dst;
#include "vsetanyeqz_b.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(__lsx_bz_b(a));
assert(__lsx_bz_b(a) == bz_b(a));

a = __m128i{1, 0};
assert(__lsx_bz_b(a));
assert(__lsx_bz_b(a) == bz_b(a));

a = __m128i{0, 1};
assert(__lsx_bz_b(a));
assert(__lsx_bz_b(a) == bz_b(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(!__lsx_bz_b(a));
assert(__lsx_bz_b(a) == bz_b(a));

a = __m128i{0x1111111111111100, 0x1111111111111111};
assert(__lsx_bz_b(a));
assert(__lsx_bz_b(a) == bz_b(a));
}
13 changes: 12 additions & 1 deletion code/vsetanyeqz_d.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bz_d(v128 a) {
int dst;
#include "vsetanyeqz_d.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(__lsx_bz_d(a));
assert(__lsx_bz_d(a) == bz_d(a));

a = __m128i{1, 0};
assert(__lsx_bz_d(a));
assert(__lsx_bz_d(a) == bz_d(a));

a = __m128i{0, 1};
assert(__lsx_bz_d(a));
assert(__lsx_bz_d(a) == bz_d(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(!__lsx_bz_d(a));
assert(__lsx_bz_d(a) == bz_d(a));

a = __m128i{0x0, 0x1111111111111111};
a = __m128i{0x0000000000000000, 0x1111111111111111};
assert(__lsx_bz_d(a));
assert(__lsx_bz_d(a) == bz_d(a));
}
11 changes: 11 additions & 0 deletions code/vsetanyeqz_h.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bz_h(v128 a) {
int dst;
#include "vsetanyeqz_h.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(__lsx_bz_h(a));
assert(__lsx_bz_h(a) == bz_h(a));

a = __m128i{1, 0};
assert(__lsx_bz_h(a));
assert(__lsx_bz_h(a) == bz_h(a));

a = __m128i{0, 1};
assert(__lsx_bz_h(a));
assert(__lsx_bz_h(a) == bz_h(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(!__lsx_bz_h(a));
assert(__lsx_bz_h(a) == bz_h(a));

a = __m128i{0x1111111111110000, 0x1111111111111111};
assert(__lsx_bz_h(a));
assert(__lsx_bz_h(a) == bz_h(a));
}
13 changes: 12 additions & 1 deletion code/vsetanyeqz_w.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#include "common.h"

int bz_w(v128 a) {
int dst;
#include "vsetanyeqz_w.h"
return dst;
}

void test() {
__m128i a = {0, 0};
assert(__lsx_bz_w(a));
assert(__lsx_bz_w(a) == bz_w(a));

a = __m128i{1, 0};
assert(__lsx_bz_w(a));
assert(__lsx_bz_w(a) == bz_w(a));

a = __m128i{0, 1};
assert(__lsx_bz_b(a));
assert(__lsx_bz_w(a));
assert(__lsx_bz_w(a) == bz_w(a));

a = __m128i{0x1111111111111111, 0x1111111111111111};
assert(!__lsx_bz_w(a));
assert(__lsx_bz_w(a) == bz_w(a));

a = __m128i{0x1111111100000000, 0x1111111111111111};
assert(__lsx_bz_w(a));
assert(__lsx_bz_w(a) == bz_w(a));
}
Loading

0 comments on commit f386dfc

Please sign in to comment.