Add softrvv_vxor test with template
Added vxor test utilizing the numpy/python template approach.
Change-Id: I4e4f0a0b2904b751d4705bf3dc86e7295c37be40
diff --git a/softrvv/include/softrvv.h b/softrvv/include/softrvv.h
index e056e13..30326c1 100644
--- a/softrvv/include/softrvv.h
+++ b/softrvv/include/softrvv.h
@@ -14,6 +14,7 @@
#include "softrvv_vsub.h"
#include "softrvv_vwadd.h"
#include "softrvv_vwsub.h"
+#include "softrvv_vxor.h"
namespace softrvv {
diff --git a/softrvv/include/softrvv_vxor.h b/softrvv/include/softrvv_vxor.h
new file mode 100644
index 0000000..7a49801
--- /dev/null
+++ b/softrvv/include/softrvv_vxor.h
@@ -0,0 +1,24 @@
+#ifndef SOFTRVV_VXOR_H
+#define SOFTRVV_VXOR_H
+
+#include <stddef.h>
+
+namespace softrvv {
+
+template <typename T>
+void vxor_vx(T *dest, T *src1, const T *src2, size_t avl) {
+ for (size_t idx = 0; idx < avl; idx++) {
+ dest[idx] = src1[idx] ^ *src2;
+ }
+}
+
+template <typename T>
+void vxor_vv(T *dest, T *src1, T *src2, size_t avl) {
+ for (size_t idx = 0; idx < avl; idx++) {
+ dest[idx] = src1[idx] ^ src2[idx];
+ }
+}
+
+} // namespace softrvv
+
+#endif // SOFTRVV_VXOR_H
diff --git a/softrvv/tests/CMakeLists.txt b/softrvv/tests/CMakeLists.txt
index 4152bb1..6fc4a44 100644
--- a/softrvv/tests/CMakeLists.txt
+++ b/softrvv/tests/CMakeLists.txt
@@ -151,3 +151,12 @@
LINKOPTS
-Xlinker --defsym=__itcm_length__=128K
)
+
+softrvv_vec_cc_generated_test(
+ NAME
+ vxor
+ TEMPLATE
+ softrvv_vxor_test.tpl.cpp
+ LINKOPTS
+ -Xlinker --defsym=__itcm_length__=128K
+)
diff --git a/softrvv/tests/templates/softrvv_vxor_test.tpl.cpp b/softrvv/tests/templates/softrvv_vxor_test.tpl.cpp
new file mode 100644
index 0000000..e87343b
--- /dev/null
+++ b/softrvv/tests/templates/softrvv_vxor_test.tpl.cpp
@@ -0,0 +1,9 @@
+<%inherit file="base.tpl.cpp"/>\
+<%namespace name="tests" file="opivv_opivx_test.tpl.cpp"/>
+<%
+import numpy as np
+src1, src2, rs1 = parent.module.get_test_inputs(np.int32, N=5)
+ref_vv = np.bitwise_xor(src1, src2)
+ref_vx = np.bitwise_xor(src1, rs1)
+%>\
+${tests.test_opivv_opivx("int32_t", op, src1, src2, rs1, ref_vv, ref_vx)}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d3546e2..d30cf2a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -55,6 +55,17 @@
vec_cc_generated_test(
NAME
+ vxor
+ OPFMT
+ OPIVV
+ OPIVX
+ OPIVI
+ LINKOPTS
+ -Xlinker --defsym=__itcm_length__=256K
+)
+
+vec_cc_generated_test(
+ NAME
vmin
OPFMT
OPIVV