Skip to content

Commit

Permalink
Use SVE widening loads for vint4(uint8_t*) (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel authored Nov 5, 2024
1 parent 779b05e commit 418a4cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Docs/ChangeLog-5x.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ The 5.1.0 release is a maintenance release.
byte-to-int index conversion.
* **Optimization:** Added improved intrinsics sequence for SSE and AVX2
`hmin()` and `hmax()`.
* **Optimization:** Added improved intrinsics sequence for `vint4(uint8_t*)`
on systems implementing Arm SVE.

<!-- ---------------------------------------------------------------------- -->
## 5.0.0
Expand Down
13 changes: 9 additions & 4 deletions Source/astcenc_vecmathlib_neon_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,15 @@ struct vint4
*/
ASTCENC_SIMD_INLINE explicit vint4(const uint8_t *p)
{
// Cast is safe - NEON loads are allowed to be unaligned
uint32x2_t t8 = vld1_dup_u32(reinterpret_cast<const uint32_t*>(p));
uint16x4_t t16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(t8)));
m = vreinterpretq_s32_u32(vmovl_u16(t16));
#if ASTCENC_SVE == 0
// Cast is safe - NEON loads are allowed to be unaligned
uint32x2_t t8 = vld1_dup_u32(reinterpret_cast<const uint32_t*>(p));
uint16x4_t t16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(t8)));
m = vreinterpretq_s32_u32(vmovl_u16(t16));
#else
svint32_t data = svld1ub_s32(svptrue_pat_b32(SV_VL4), p);
m = svget_neonq(data);
#endif
}

/**
Expand Down

0 comments on commit 418a4cd

Please sign in to comment.