Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

Error 2 error: union "__m64" has no member "m64_u8"

incaveman
Beginner
480 Views

How can I get my unsigned bytes out of __m64 using the Intel compiler? Using visual studio I can use:

__m64 myvar;

myvar = someIntrinicFunction();

unsigned char mychar = myvar.m64_u8[0]; // broken for Intel compiler.

From vs, mmintrin.h:

typedef

union __declspec(intrin_type) _CRT_ALIGN(8) __m64

{

unsigned __int64 m64_u64;

float m64_f32[2];

__int8 m64_i8[8];

__int16 m64_i16[4];

__int32 m64_i32[2];

__int64 m64_i64;

unsigned __int8 m64_u8[8];

unsigned __int16 m64_u16[4];

unsigned __int32 m64_u32[2];

}

__m64;

__64 is certainly defined for the intel compiler, why not the union? Does Intel use yet another notation (more #define hell), or do I need to waste more processor cycles doing the conversion by hand?

Thanks,

-Kevin

0 Kudos
5 Replies
Dale_S_Intel
Employee
480 Views
Well, it depends what you want to do. If you're specifically interested in just the lowest byte, you could mask it, i.e.

c = 0xff & m;

Or you can make a union (as above) or use a pointer into an array.

I don't think there's really any more processer cycles invoved in doing it by hand because when you do m64_u8[0], the compiler has to do issue similar code to extract the lowest byte and put it into a char.

Dale


0 Kudos
incaveman
Beginner
480 Views

Dale,

Thanks for the note back. I wound up making my own union, and putting #ifdefs.

I eventually gave up and un-installed the compiler, VTune, thread profiler, the works. Life is much better now, although the uninstaller left a bunch of crap in my visual studio. I will just stick with the AMD performance analyzer. Simple, easy to use, 100 times more lightweight, and much, much more effective.

Thanks again,

-Kevin

0 Kudos
WaiYeong_Y_Intel
Employee
480 Views
Well, it depends what you want to do. If you're specifically interested in just the lowest byte, you could mask it, i.e.

c = 0xff & m;

Or you can make a union (as above) or use a pointer into an array.

I don't think there's really any more processer cycles invoved in doing it by hand because when you do m64_u8[0], the compiler has to do issue similar code to extract the lowest byte and put it into a char.

Dale



Hi Dale,
I am facing the following error with __m64. Please help to provide some examples of resolution. Thanks.

__m64 var1;
var1.m64_u64 = 0x0101010101010101;

It is howing the following error: union "__m64" has no member "m64_u64".

Thanks,
Yau
0 Kudos
Quoc-An_L_Intel
Moderator
480 Views


For performance reasons, Intel compiler currently does not support this construct. The only work around at this time is to use Microsoft compiler for these instances, and use the Intel Compiler for code that does not use this construct.

The reason that it is defined in the Intel Compiler header is specifically for this purpose, allowing Microsoft built object that uses this construct, to link withIntel Compiler built object that does not use this code construct. Without the struct defined in the header, you will get a link error.

There is a pending feature request with the Intel Compiler team to support this code construct. Note that usage of this construct will result in lower runtime performance.
0 Kudos
WaiYeong_Y_Intel
Employee
480 Views
Thanks Qale for the reply. I just tried my luck with the following:
__m64var1 = {0x0101010101010101};

Its able to compile and program works fine. I guess I am lucky. :)

Thanks,
Yau

0 Kudos
Reply