diff --git a/README.md b/README.md index 5c7a3f54..9a2f6522 100644 --- a/README.md +++ b/README.md @@ -230,10 +230,6 @@ Vector Multiplication High ### vsubi.bu/hu/wu/du -### vbsll.v - -### vbsrl.v - ### vmaxi.b/h/w/d ### vmini.b/h/w/d diff --git a/code/vbitseli_b.cpp b/code/vbitseli_b.cpp index 9a70ef57..f22d9603 100644 --- a/code/vbitseli_b.cpp +++ b/code/vbitseli_b.cpp @@ -7,9 +7,9 @@ v128 vbitseli_b(v128 a, v128 b, int imm) { } void test() { - FUZZ2(vbitseli_b, 0x00); - FUZZ2(vbitseli_b, 0x01); - FUZZ2(vbitseli_b, 0x01); - FUZZ2(vbitseli_b, 0x80); - FUZZ2(vbitseli_b, 0xFF); - } + FUZZ2(vbitseli_b, 0x00); + FUZZ2(vbitseli_b, 0x01); + FUZZ2(vbitseli_b, 0x01); + FUZZ2(vbitseli_b, 0x80); + FUZZ2(vbitseli_b, 0xFF); +} diff --git a/code/vbsll_v.cpp b/code/vbsll_v.cpp new file mode 100644 index 00000000..9ea2e951 --- /dev/null +++ b/code/vbsll_v.cpp @@ -0,0 +1,18 @@ +#include "common.h" + +v128 vbsll_v(v128 a, int imm) { + v128 dst; +#include "vbsll_v.h" + return dst; +} + +void test() { + FUZZ1(vbsll_v, 0); + FUZZ1(vbsll_v, 3); + FUZZ1(vbsll_v, 7); + FUZZ1(vbsll_v, 8); + FUZZ1(vbsll_v, 16); + FUZZ1(vbsll_v, 24); + FUZZ1(vbsll_v, 25); + FUZZ1(vbsll_v, 31); +} diff --git a/code/vbsll_v.h b/code/vbsll_v.h new file mode 100644 index 00000000..cd00e0fe --- /dev/null +++ b/code/vbsll_v.h @@ -0,0 +1,2 @@ +int shift = (imm * 8) % 128; +dst.qword[0] = (u128)a.qword[0] << shift; \ No newline at end of file diff --git a/code/vbsrl_v.cpp b/code/vbsrl_v.cpp new file mode 100644 index 00000000..c00ab86c --- /dev/null +++ b/code/vbsrl_v.cpp @@ -0,0 +1,18 @@ +#include "common.h" + +v128 vbsrl_v(v128 a, int imm) { + v128 dst; +#include "vbsrl_v.h" + return dst; +} + +void test() { + FUZZ1(vbsrl_v, 0); + FUZZ1(vbsrl_v, 3); + FUZZ1(vbsrl_v, 7); + FUZZ1(vbsrl_v, 8); + FUZZ1(vbsrl_v, 16); + FUZZ1(vbsrl_v, 24); + FUZZ1(vbsrl_v, 25); + FUZZ1(vbsrl_v, 31); +} diff --git a/code/vbsrl_v.h b/code/vbsrl_v.h new file mode 100644 index 00000000..4605d2f8 --- /dev/null +++ b/code/vbsrl_v.h @@ -0,0 +1,2 @@ +int shift = (imm * 8) % 128; +dst.qword[0] = (u128)a.qword[0] >> shift; \ No newline at end of file diff --git a/docs/lsx_integer/vshift.md b/docs/lsx_integer/vshift.md new file mode 100644 index 00000000..5df3810b --- /dev/null +++ b/docs/lsx_integer/vshift.md @@ -0,0 +1,43 @@ +# Shift + +## __m128i __lsx_vbsll_v (__m128i a, imm0_31 imm) + +### Synopsis + +```c++ +__m128i __lsx_vbsll_v (__m128i a, imm0_31 imm) +#include +Instruction: vbsll.v vr, vr, imm +CPU Flags: LSX +``` + +### Description + +Compute 128-bit `a` shifted left by `imm * 8` bits. + +### Operation + +```c++ +{% include 'vbsll_v.h' %} +``` + +## __m128i __lsx_vbsrl_v (__m128i a, imm0_31 imm) + +### Synopsis + +```c++ +__m128i __lsx_vbsrl_v (__m128i a, imm0_31 imm) +#include +Instruction: vbsrl.v vr, vr, imm +CPU Flags: LSX +``` + +### Description + +Compute 128-bit `a` shifted right by `imm * 8` bits. + +### Operation + +```c++ +{% include 'vbsrl_v.h' %} +``` \ No newline at end of file