"error: expression must have class type" is a bug???

"error: expression must have class type" is a bug???

cutxyz的头像

i am a beginer of the parallel studio......something wrongs in my program.....

#include

class __declspec(dllexport) Vector4SSE
{
public:
union{
__m128 m_Vec;
struct
{
float x,y,z,w;
};
float m_elem[4];
};

public:
inline Vector4SSE(void)
{
// do nothing
}

inline Vector4SSE(float x, float y, float z, float w = 1.0f)
{
m_Vec = _mm_set_ps(w,z,y,x);
}

inline Vector4SSE(float value)
{
Set(value);
}

inline Vector4SSE(unsigned int x, unsigned int y, unsigned int z, unsigned int w)
{
m_Vec.m128_u32[0] = x; //they all passed in vc9.0,but if i used Intel C++ Compiler 11.1.061 [IA-32],they all have
// aerror: expression must have class type or class "__m128" has no member "m128_u32"
//we can find "__m128" details in xmmintrin.h, it has been define and it has member
// "m128_u32",why ????? it is a bug????? or something wrongs in my config????

m_Vec.m128_u32[1] = y;
m_Vec.m128_u32[2] = z;
m_Vec.m128_u32[3] = w;
}
..........................and so on //
};

10 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Kittur Ganesh (Intel)的头像

Hi,

The __m128 data type iseither four packed single-precision floating-point values or one scalar single-precision number and hence you'll get the compile error on "not a class type". The following post at: http://software.intel.com/en-us/forums/showthread.php?t=46162 gives more info on using intrinsic fundtions on initialization/access of data type values.You can also visit the Knowledge base/Forums where you can find many topics related to SSE/intrinsics that is useful at:
Tools Knowledge Base: http://software.intel.com/en-us/articles/tools
User forums: http://software.intel.com/en-us/forums/

-regards,

Kittur

cutxyz的头像
Quoting - Kittur Ganesh (Intel)

Hi,

The __m128 data type iseither four packed single-precision floating-point values or one scalar single-precision number and hence you'll get the compile error on "not a class type". The following post at: http://software.intel.com/en-us/forums/showthread.php?t=46162 gives more info on using intrinsic fundtions on initialization/access of data type values.You can also visit the Knowledge base/Forums where you can find many topics related to SSE/intrinsics that is useful at:
Tools Knowledge Base: http://software.intel.com/en-us/articles/tools
User forums: http://software.intel.com/en-us/forums/

-regards,

Kittur

I find __m128 in xmmintrin.h was defined as a union,it has the memberm128_u32,why i can't use it as
__m128a;
unsigned int b = 1;
a.m128_u32[0] = b;

the define in xmmintrin.h
typedef union __declspec(intrin_type) _CRT_ALIGN(16) __m128 {
float m128_f32[4];
unsigned __int64 m128_u64[2];
__int8 m128_i8[16];
__int16 m128_i16[8];
__int32 m128_i32[4];
__int64 m128_i64[2];
unsigned __int8 m128_u8[16];
unsigned __int16 m128_u16[8];
unsigned __int32 m128_u32[4];
} __m128;

Kittur Ganesh (Intel)的头像

Hi,
Good point. I looked at the xmmintrin.h include file under Composer include directory, and the definition for __m128 is just that: ... __declspec(align(16)) {float f[4];} __m128; Hence, when you compile with Composer, you'll get compilation errors as there are no fields such as m128_u32 etc.

But, the union definition is in VC, and hence you'll be able to compile fine.

This means this is either a bug (due to compatibility issue with MS) or a feature request. I'll check with our development team and get back to you as soon as I have an update.

In the meantime, you can compile that file containing __m128 code with VC. Appreciate your patience till I get an update on this.

-regards.

cutxyz的头像
I find it,__m128has somedifference in intel vertion, but how to set path, and let me use the ms vertion, it can set path in vs2008? and it have other differcence things in the *.h files like that?

Kittur Ganesh (Intel)的头像
Best Reply

Hi,
The latest update I have on this issue is that there is no support presently for MS __m128 union data type due to performance considerations. Of course, there is a feature request filed with our developers to look into supporting the union data type.

Regarding your question, all you have to do to compile the file containing the __m128 union code with MS
compiler is:
From the Project menu, or project context menu, select Intel Parallel Composer -> Use Visual C++

Compiling any file now would be using the Visusl C++, and the IDE component automatically takes care of the
includes path settings to come from MS VCYou can select and compile those files containing the __m128 code and
thecode will be compiled by MSVC

Likewise, at any time you can switch to "Use Intel C++" using the project context menu, and selecting Intel
ParallelComposer->Use Intel C++. Here again, the IDE component would reset so the includes to come from
Intel Compiler include path.....

-regards
Kittur

Manuj Sabharwal (Intel)的头像
Quoting - Kittur Ganesh (Intel)
Hi,
The latest update I have on this issue is that there is no support presently for MS __m128 union data type due to performance considerations. Of course, there is a feature request filed with our developers to look into supporting the union data type.

Regarding your question, all you have to do to compile the file containing the __m128 union code with MS
compiler is:
From the Project menu, or project context menu, select Intel Parallel Composer -> Use Visual C++

Compiling any file now would be using the Visusl C++, and the IDE component automatically takes care of the
includes path settings to come from MS VCYou can select and compile those files containing the __m128 code and
thecode will be compiled by MSVC

Likewise, at any time you can switch to "Use Intel C++" using the project context menu, and selecting Intel
ParallelComposer->Use Intel C++. Here again, the IDE component would reset so the includes to come from
Intel Compiler include path.....

-regards
Kittur

Hi Ganesh,

Is the feature of having union of _m128 is added to ICC ??? Because for some reason I need to use ICC instead of VC.

THanks,
Manuj

Kittur Ganesh (Intel)的头像

Hi Manoj,

The feature request is still under investigation as of now and so presently its status quo with the existing release we have. Nevertheless, I've let the developers know of additional request for this feature request to be supported. I will touch base with you as soon as I've any additional update if this feature request gets implemented in our future release. Appreciate your patience till then.

-regards,
Kittur

Kittur Ganesh (Intel)的头像

Manoj, this is fixed in the latest released version of Composer, just FYI.

Regards,
Kittur

Sangappa P.的头像

Hi Ganesh,
How to address similar problem when compiling in Microsoft Visual C++ 6.0? There is no such selection as "Use Visual C++".

Quote:

Kittur Ganesh (Intel) wrote:

Hi,
The latest update I have on this issue is that there is no support presently for MS __m128 union data type due to performance considerations. Of course, there is a feature request filed with our developers to look into supporting the union data type.

Regarding your question, all you have to do to compile the file containing the __m128 union code with MS
compiler is:
From the Project menu, or project context menu, select Intel Parallel Composer -> Use Visual C++

Compiling any file now would be using the Visusl C++, and the IDE component automatically takes care of the
includes path settings to come from MS VCYou can select and compile those files containing the __m128 code and
thecode will be compiled by MSVC

Likewise, at any time you can switch to "Use Intel C++" using the project context menu, and selecting Intel
ParallelComposer->Use Intel C++. Here again, the IDE component would reset so the includes to come from
Intel Compiler include path.....

-regards
Kittur

登陆并发表评论。