To load 64 bits (which is 8 bytes) of data into an __m128i
register (which typically holds 128 bits or 16 bytes), you need to pad or extend the 64-bit data to fill the full width of the register.
Here are several ways to do this depending on your context:
If you want to pad the remaining 8 bytes with zeros, you can use SSE2 instructions (movq
followed by pslldq
):
__m128i load64_zero_pad(uint64_t data) {
__m128i result;