vendredi 22 juillet 2016

byte order in xmm clang assembly comments

Given the following program:

#include "emmintrin.h"

int main(int argc, char *argv[])
{
    volatile __m128i x = _mm_set_epi64x(1, 0);
    return 0;
}

I can get the assembly using clang -O -S test.c (only listing the interesting part):

...
movl    $1, %eax
movd    %rax, %xmm0
pslldq  $8, %xmm0               # xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
...

According to the manual of _mm_set_epi64x, %xmm0 should be [0, 1, 0, 0], with each element being an integer (32 bits).

However, according to the comment, %xmm0 holds [0, 0, 0, 1]. I don't think endianness is relevant here, for I am only looking at a register.

I suspect that it's sth related to the notation used by clang assembly comment, but I can't find any useful info on it.

Aucun commentaire:

Enregistrer un commentaire