From 820b99c43329a135b56d3adbb67775c7b16a89c2 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Mon, 11 Dec 2023 23:56:40 +0800 Subject: [PATCH] Add vshuf.b --- README.md | 6 ------ docs/lsx_misc/vshuf.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 docs/lsx_misc/vshuf.md 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]; + } +} +```