Skip to content

Commit

Permalink
Add tests for vset
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 14, 2023
1 parent f386dfc commit 8166a82
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions code/xvseteqz_v.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "common.h"

int xbz_v(v256 a) {
int dst;
#include "xvseteqz_v.h"
return dst;
}

void test() {
__m256i a = {0, 0};
assert(__lasx_xbz_v(a));
assert(__lasx_xbz_v(a) == xbz_v(a));

a = __m256i{1, 0};
assert(!__lasx_xbz_v(a));
assert(__lasx_xbz_v(a) == xbz_v(a));

a = __m256i{0, 1};
assert(!__lasx_xbz_v(a));
assert(__lasx_xbz_v(a) == xbz_v(a));
}
21 changes: 21 additions & 0 deletions code/xvsetnez_v.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "common.h"

int xbnz_v(v256 a) {
int dst;
#include "xvsetnez_v.h"
return dst;
}

void test() {
__m256i a = {0, 0};
assert(!__lasx_xbnz_v(a));
assert(__lasx_xbnz_v(a) == xbnz_v(a));

a = __m256i{1, 0};
assert(__lasx_xbnz_v(a));
assert(__lasx_xbnz_v(a) == xbnz_v(a));

a = __m256i{0, 1};
assert(__lasx_xbnz_v(a));
assert(__lasx_xbnz_v(a) == xbnz_v(a));
}

0 comments on commit 8166a82

Please sign in to comment.