Skip to content

Commit

Permalink
Add vshuf.b
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 11, 2023
1 parent 7b0cab0 commit 820b99c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ Vector Float Compare

<cmp>: See fcmp.cond.s/d instruction

### vshuf.b

Vector Shuffle

`__m128i __lsx_vshuf_b (__m128i a, __m128i b, __m128i c)`

### vld

Vector Load
Expand Down
28 changes: 28 additions & 0 deletions docs/lsx_misc/vshuf.md
Original file line number Diff line number Diff line change
@@ -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 <lsxintrin.h>
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];
}
}
```

0 comments on commit 820b99c

Please sign in to comment.