2

_mm_store_ps stores (for example) 128 bit in a 4 float elements of an array.

Can I store only 96 bit? or rather, only first 3 byte in 3 elements of array? (with SSE instuctions)


I explained myself badly: I do not want to mask the bits. I would like to store only the first 3 bytes, without copying the remaining 32 bits. Without overwriting beyond the memory

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
  • No, you need to build the 128 bits to store by mixing the 96 bits you want to write with the 32 bits that were already there. This is certainly doable but will involve a lot of shuffling around in addition to the 128-bit read. – Pascal Cuoq Sep 18 '13 at 12:17

1 Answers1

4

You can do it with _mm_maskmoveu_si128 (SSE2) or _mm_maskstore_ps (AVX). However, you shouldn't expect good performance from these instructions.

Marat Dukhan
  • 11,993
  • 4
  • 27
  • 41
  • I explained myself badly: I don't want to mask the bits. I would like to store only the first 3 bytes, without copying the remaining 32 bits. Without overwriting beyond the memory – user2120196 Sep 19 '13 at 06:41
  • 2
    @user2120196 that's what you got, unless you explained yourself badly again. – harold Sep 19 '13 at 14:48
  • Better explaining the names: it masks bits from being stored at all. Thus exactly what you want :) – St0fF Jun 08 '18 at 18:24