From 8166a820e9feb4ef95942e118bdd33d24cb23b58 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Thu, 14 Dec 2023 20:16:54 +0800 Subject: [PATCH] Add tests for vset --- code/xvseteqz_v.cpp | 21 +++++++++++++++++++++ code/xvsetnez_v.cpp | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 code/xvseteqz_v.cpp create mode 100644 code/xvsetnez_v.cpp diff --git a/code/xvseteqz_v.cpp b/code/xvseteqz_v.cpp new file mode 100644 index 00000000..b07c02d6 --- /dev/null +++ b/code/xvseteqz_v.cpp @@ -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)); +} \ No newline at end of file diff --git a/code/xvsetnez_v.cpp b/code/xvsetnez_v.cpp new file mode 100644 index 00000000..439c98b9 --- /dev/null +++ b/code/xvsetnez_v.cpp @@ -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)); +} \ No newline at end of file