diff --git a/README.md b/README.md index 799de94a..5c7a3f54 100644 --- a/README.md +++ b/README.md @@ -390,8 +390,6 @@ Vector Multiplication High ### vshuf4i.b/h/w/d -### vbitseli.b - ### vori.b ### vxori.b diff --git a/code/vbitseli_b.cpp b/code/vbitseli_b.cpp new file mode 100644 index 00000000..9a70ef57 --- /dev/null +++ b/code/vbitseli_b.cpp @@ -0,0 +1,15 @@ +#include "common.h" + +v128 vbitseli_b(v128 a, v128 b, int imm) { + v128 dst; +#include "vbitseli_b.h" + return dst; +} + +void test() { + FUZZ2(vbitseli_b, 0x00); + FUZZ2(vbitseli_b, 0x01); + FUZZ2(vbitseli_b, 0x01); + FUZZ2(vbitseli_b, 0x80); + FUZZ2(vbitseli_b, 0xFF); + } diff --git a/code/vbitseli_b.h b/code/vbitseli_b.h new file mode 100644 index 00000000..535352c5 --- /dev/null +++ b/code/vbitseli_b.h @@ -0,0 +1,3 @@ +for (int i = 0; i < 16; i++) { + dst.byte[i] = (~a.byte[i] & b.byte[i]) | (a.byte[i] & (u8)imm); +} \ No newline at end of file diff --git a/docs/lsx_bitops/vbitwise.md b/docs/lsx_bitops/vbitwise.md index ad1a5dc1..cf3496b6 100644 --- a/docs/lsx_bitops/vbitwise.md +++ b/docs/lsx_bitops/vbitwise.md @@ -21,6 +21,27 @@ Compute bitwise selection: for each bit position, if the bit in `c` equals to on {% include 'vbitsel_v.h' %} ``` +## __m128i __lsx_vbitseli_b (__m128i a, __m128i b, imm0_255 imm) + +### Synopsis + +```c++ +__m128i __lsx_vbitseli_b (__m128i a, __m128i b, imm0_255 imm) +#include +Instruction: vbitseli.b vr, vr, imm +CPU Flags: LSX +``` + +### Description + +Compute bitwise selection: for each bit position, if the bit in `a` equals to one, copy the bit from `imm` to `dst`, otherwise copy from `b`. + +### Operation + +```c++ +{% include 'vbitseli_b.h' %} +``` + {{ vbitclr('b') }} {{ vbitclr('h') }} {{ vbitclr('w') }}