Skip to content

Commit

Permalink
Add union definition in index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Apr 18, 2024
1 parent 55bfc21 commit e52038f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,27 @@ This is the Unofficial LoongArch Intrinsics Guide by Jiajie Chen et, al. The doc
- QEMU
- GCC
- Observations from real hardware incl. 3C5000 and 3A6000

The guide provides pseudo code for the SIMD intrinsics. The code assumes that the elements of the LSX/LASX vector registers can be accessed via members of a `union`:

```cpp
union lsx_register {
uint8_t byte[16];
uint16_t half[8];
uint32_t word[4];
uint64_t dword[2];
uint128_t qword[1];
float fp32[4];
double fp64[2];
};

union lasx_register {
uint8_t byte[32];
uint16_t half[16];
uint32_t word[8];
uint64_t dword[4];
uint128_t qword[2];
float fp32[8];
double fp64[4];
};
```

0 comments on commit e52038f

Please sign in to comment.