diff --git a/README.md b/README.md index 0802f676..8f2e59d2 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,6 @@ Vector Float Compare : See fcmp.cond.s/d instruction -### vshuf.b - -Vector Shuffle - -`__m128i __lsx_vshuf_b (__m128i a, __m128i b, __m128i c)` - ### vld Vector Load diff --git a/docs/lsx_misc/vshuf.md b/docs/lsx_misc/vshuf.md new file mode 100644 index 00000000..320bba41 --- /dev/null +++ b/docs/lsx_misc/vshuf.md @@ -0,0 +1,28 @@ +# Shuffling + +## __m128i __lsx_vshuf_b (__m128i a, __m128i b, __m128i c) + +### Synopsis + +```c++ +__m128i __lsx_vshuf_b (__m128i a, __m128i b, __m128i c) +#include +Instruction: vshuf.b vr, vr, vr +CPU Flags: LSX +``` + +### Description + +Shuffle bytes from `a` and `b` with indices from `c`. + +### Operation + +```c++ +for (int i = 0;i < 16;i++) { + if (c.byte[i] % 32 < 16) { + dst.byte[i] = b.byte[c.byte[i] % 16]; + } else { + dst.byte[i] = a.byte[c.byte[i] % 16]; + } +} +```