The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: johnsa on January 20, 2012, 10:37:16 AM

Title: properly typed XMM storage
Post by: johnsa on January 20, 2012, 10:37:16 AM
Hey,

I've always like the way that an _mm128 is represented in VC++ ... With the later masm versions etc they added MMWORD and XMMWORD types but these don't present the same (or proper) view in a debugger like Visual Studio.
I thought it might be useful to encapsulate it in some sort of union/struct like the following:

_mm128 union 16
struct ui
   i0 dd ?
   i1 dd ?
   i2 dd ?
   i3 dd ?
ends
struct f      
   f0 real4 ?
   f1 real4 ?
   f2 real4 ?
   f3 real4 ?
ends
struct ul
   ul0 dq ?
   ul1 dq ?
ends
struct d
   d0 real8 ?
   d1 real8 ?   
ends
_mm128 ends

This seems to work partially in that I can see the type in the VS debugger, but the sub types don't list their elements.. any suggestions?
Title: Re: properly typed XMM storage
Post by: johnsa on January 20, 2012, 10:56:23 AM
Got it working... for anyone interested:

; A proper type definition for an XMMWORD that allows debugger to see sub-elements/types.
__mm128i struct
   i0 DWORD ?
   i1 DWORD ?
   i2 DWORD ?
   i3 DWORD ?   
__mm128i ends

_mm128i typedef __mm128i

__mm128f struct      
   f0 real4 ?
   f1 real4 ?
   f2 real4 ?
   f3 real4 ?
__mm128f ends

_mm128f typedef __mm128f

_mm128 union 16
   i32 _mm128i <>
   f32 _mm128f <>
_mm128 ends

Feel free to add the double/qword types too.. at least i can now allocate this on stack or global and see the same breakdown that you'd get from C++ with an MM type.