Interpreting GDB Registers (SSE Registers)

I have been using GDB for 1 day, and I have gained a decent understanding of this. However, when I set a breakpoint at the end semicolon using GDB and print registers, I cannot fully interpret the meaning of the data stored in the XMM register.

I do not know if the data is in the format (MSB> LSB) or vice versa.

    __m128i S = _mm_load_si128((__m128i*)Array16Bytes);

}

So this is the result that I get.

(gdb) print $xmm0
$1 = {
  v4_float = {1.2593182e-07, -4.1251766e-18, -5.43431603e-31, -2.73406277e-14}, 
  v2_double = {4.6236050467459811e-58, -3.7422963639201271e-245}, 
  v16_int8 = {52, 7, 55, -32, -94, -104, 49, 49, -115, 48, 90, -120, -88, -10, 67, 50}, 
  v8_int16 = {13319, 14304, -23912, 12593, -29392, 23176, -22282, 17202}, 
  v4_int32 = {872888288, -1567084239, -1926210936, -1460255950}, 
  v2_int64 = {3749026652749312305, -8273012972482837710}, 
  uint128 = 0x340737e0a29831318d305a88a8f64332
}

So someone will kindly tell me how to interpret the data.

+4
source share
1 answer

SSE registers (XMM) can be interpreted in various ways. The register itself does not know about the implicit representation of the data; it simply stores 128 bits of data. The XMM register may represent:

4 x 32 bit floats        __m128
2 x 64 bit doubles       __m128d
16 x 8 bit ints          __m128i
8 x 16 bit ints          __m128i
4 x 32 bit ints          __m128i
2 x 64 bit ints          __m128i
128 individual bits      __m128i

, gdb XMM, , .

, (, 16 x 8 int), :

(gdb) p $xmm0.v16_int8
$1 = {0, 0, 0, 0, 0, 0, 0, 0, -113, -32, 32, -50, 0, 0, 0, 2}

endianness, gdb , , MS LS.

, :

#include <stdio.h>
#include <stdint.h>

#include <xmmintrin.h>
int main(int argc, char *argv[])
{
    int8_t buff[16] __attribute__ ((aligned(16))) = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };

    __m128i v = _mm_load_si128((__m128i *)buff);

    printf("v = %vd\n", v);

    return 0;
}

, :

v = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

, gdb v, :

v16_int8 = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+7

All Articles