Skip to content

Commit

Permalink
Add fclass
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 12, 2023
1 parent 3ac4200 commit 793c160
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 5 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ Vector Multiplication High

### vsignconv.b/h/w/d

### vfadd.s/d

### vfsub.s/d

### vfmul.s/d
Expand Down Expand Up @@ -260,8 +258,6 @@ Vector Multiplication High

### vflogb.s/d

### vfclass.s/d

### vfsqrt.s/d

### vfrecip.s/d
Expand Down
2 changes: 1 addition & 1 deletion docs/lsx/float_comparison.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Float Comparison
# Floating Point Comparison

## __m128i __lsx_vfcmp_cond_s (__m128 a, __m128 b)

Expand Down
47 changes: 47 additions & 0 deletions docs/lsx/float_computation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Floating Point Computation

## __m128d __lsx_vfadd_d (__m128d a, __m128d b)

### Synopsis

```c++
__m128d __lsx_vfadd_d (__m128d a, __m128d b)
#include <lsxintrin.h>
Instruction: vfadd.d vr, vr, vr
CPU Flags: LSX
```
### Description
Add double precision floating point elements in `a` to `b` and store the result in `dst`.
### Operation
```c++
for (int i = 0;i < 2;i++) {
dst.fp64[i] = a.fp64[i] + b.fp64[i];
}
```

## __m128 __lsx_vfadd_s (__m128 a, __m128 b)

### Synopsis

```c++
__m128d __lsx_vfadd_s (__m128d a, __m128d b)
#include <lsxintrin.h>
Instruction: vfadd.s vr, vr, vr
CPU Flags: LSX
```
### Description
Add single precision floating point elements in `a` to `b` and store the result in `dst`.
### Operation
```c++
for (int i = 0;i < 4;i++) {
dst.fp32[i] = a.fp32[i] + b.fp32[i];
}
```
47 changes: 47 additions & 0 deletions docs/lsx/float_misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Floatint Point Misc

## __m128i __lsx_vfclass_d (__m128d a)

### Synopsis

```c++
__m128i __lsx_vfclass_d (__m128d a)
#include <lsxintrin.h>
Instruction: vfclass.d vr, vr
CPU Flags: LSX
```
### Description
Classifiy each double precision floating point elements in `a`.
### Operation
```c++
for (int i = 0;i < 2;i++) {
dst.dword[i] = fp_classify(a.fp64[i]);
}
```

## __m128i __lsx_vfclass_s (__m128 a)

### Synopsis

```c++
__m128i __lsx_vfclass_s (__m128d a)
#include <lsxintrin.h>
Instruction: vfclass.s vr, vr
CPU Flags: LSX
```
### Description
Classifiy each single precision floating point elements in `a`.
### Operation
```c++
for (int i = 0;i < 4;i++) {
dst.word[i] = fp_classify(a.fp32[i]);
}
```

0 comments on commit 793c160

Please sign in to comment.