diff --git a/code/xvftint_w_d.cpp b/code/xvftint_w_d.cpp new file mode 100644 index 0000000..55fc3fe --- /dev/null +++ b/code/xvftint_w_d.cpp @@ -0,0 +1,19 @@ +#include "common.h" + +v256 xvftint_w_d(v256 a, v256 b) { + v256 dst; +#include "xvftint_w_d.h" + return dst; +} + +void test() { + { + __m256d a = {1.0, 2.0, 3.0, 4.0}; + __m256d b = {5.0, 6.0, 7.0, 8.0}; + PRINT(a); + PRINT(b); + PRINT(__lasx_xvftint_w_d(a, b)); + PRINT(xvftint_w_d(a, b)); + assert(xvftint_w_d(a, b) == __lasx_xvftint_w_d(a, b)); + } +} diff --git a/code/xvftint_w_d.h b/code/xvftint_w_d.h index 033e549..1e2eab1 100644 --- a/code/xvftint_w_d.h +++ b/code/xvftint_w_d.h @@ -1,5 +1,10 @@ for (int i = 0; i < 4; i++) { - dst.dword[i] = (i < 2) - ? (s64)a.fp64[i] - : (s64)b.fp64[i]; // rounding mode is not expressed in C + dst.word[i] = (i < 2) + ? (s64)b.fp64[i] + : (s64)a.fp64[i - 2]; // rounding mode is not expressed in C +} +for (int i = 4; i < 8; i++) { + dst.word[i] = (i < 6) + ? (s64)b.fp64[i - 2] + : (s64)a.fp64[i - 4]; // rounding mode is not expressed in C }