This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Efficient way to copy a single-byte value of a word to every byte of another word?

Hello,

Is there an efficient way to copy a single-byte value contained in a word to every byte of a word (later to be used by a 4-way SIMD instruction):

The code for C66 I have come up myself is quite long and inefficient (I am starving on S/L/D units, so thats why I use ROTL instead of shift), it extracts the 2nd byte of a word, and copies it to every byte of another word:

[code]

                MOVK             0x000000ff, mask

                ROTL             values_3210, 16, values_1032

                AND                values_1032, mask, simdByte2
                ROTL            simdByte2, 8, simdByte2_tmp
                OR                simdByte2, simdByte2_tmp, simdByte2
                ROTL            simdByte2, 16, simdByte2_tmp
                OR                simdByte2, simdByte2_tmp, simdByte2

[/code]

Any suggestions are highly welcomed :)

Thank you in advance, Clemens