diff --git a/README.md b/README.md index 13d3946b..0802f676 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,10 @@ -# LoongArch SIMD 指令非官网文档 +# Unofficial LoongArch Intrinsics Guide -从 QEMU 实现中整理。 +Visit -GCC Intrinsic: +Arranged from QEMU implementation and [GCC Intrinsics](https://gcc.gnu.org/onlinedocs/gcc/LoongArch-SX-Vector-Intrinsics.html) -## LSX - -### vfmadd.s/d - -Vector Fused Multiply Add (`a * b + c`) Single/Double Precision - -- Single Precision: `__m128 __lsx_vfmadd_s (__m128 a, __m128 b, __m128 c)` -- Double Precision: `__m128d __lsx_vfmadd_d (__m128d a, __m128d b, __m128d c)` - -### vfmsub.s/d - -Vector Fused Multiply Subtract (`a * b - c`) Single/Double Precision - -- Single Precision: `__m128 __lsx_vfmsub_s (__m128 a, __m128 b, __m128 c)` -- Double Precision: `__m128d __lsx_vfmsub_d (__m128d a, __m128d b, __m128d c)` - -### vfnmadd.s/d - -Vector Fused Negative Multiply Add (`- a * b - c`) Single/Double Precision - -- Single Precision: `__m128 __lsx_vfnmadd_s (__m128 a, __m128 b, __m128 c)` -- Double Precision: `__m128d __lsx_vfnmadd_d (__m128d a, __m128d b, __m128d c)` - -### vfnmsub.s/d - -Vector Fused Negative Multiply Subtract (`- a * b + c`) Single/Double Precision - -- Single Precision: `__m128 __lsx_vfnmsub_s (__m128 a, __m128 b, __m128 c)` -- Double Precision: `__m128d __lsx_vfnmsub_d (__m128d a, __m128d b, __m128d c)` +TODO List: ### vfcmp.cond.s/d @@ -40,12 +12,6 @@ Vector Float Compare : See fcmp.cond.s/d instruction -### vbitsel.v - -Vector Bit Selection: For each bit, `c ? b : a` - -`__m128i __lsx_vbitsel_v (__m128i a, __m128i b, __m128i c)` - ### vshuf.b Vector Shuffle diff --git a/docs/lsx_bitops/vbitsel.md b/docs/lsx_bitops/vbitsel.md new file mode 100644 index 00000000..61f75056 --- /dev/null +++ b/docs/lsx_bitops/vbitsel.md @@ -0,0 +1,24 @@ +# Bitwise Selection + +## __m128d __lsx_vfnmsub_d (__m128d a, __m128d b, __m128d c) + +### Synopsis + +```c++ +__m128i __lsx_vbitsel_v (__m128i a, __m128i b, __m128i c) +#include +Instruction: vbitsel.v vr, vr, vr +CPU Flags: LSX +``` + +### Description + +Compute bitwise selection: for each bit position, if the bit in `c` equals to one, copy the bit from `b` to `dst`, otherwise copy from `a`. + +### Operation + +```c++ +for (int i = 0;i < 128;i++) { + dst.bit[i] = a.bit[i] ? b.bit[i] : c.bit[i]; +} +```