- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I just tried whether I can make use of the scalar access members defined for all __m128/256 types in the ICC intrinsics headers. But ICC thinks those types are classes while at the same time they are not classes. See for yourself:
[cpp]
#include <xmmintrin.h>
int main() {
__m128 v;
v.m128_f32[0] = 0.f;
v.foo[0] = 0.f;
return 0;
}
[/cpp]
When I compile this with 'icpc main.cpp' I get:
[plain]
main.cpp(4): error: expression must have class type
v.m128_f32[0] = 0.f;
^
main.cpp(5): error: class "__m128" has no member "foo"
v.foo[0] = 0.f;
^
main.cpp(5): error: expression must have class type
v.foo[0] = 0.f;
^
compilation aborted for main.cpp (code 2)
[/plain]
Note how ICC says 'class "__m128"...' and for the same object 'must have class type'. If __m128 is not class type, what else could it be? A fundamental type. I'd be happy if it were, but it's not. Something is not as it was meant to be, I'd say...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, that's a bit unexpected. So what is __m128 then? And what are the m128_f32 and friends members for if they can't be accessed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sergey Kostrov wrote:
>>...that's a bit unexpected. So what is __m128 then?
It is declared as a union ( a fundamental type in C and C++ languages ).
But it doesn't behave like one. Which is the whole point of the discussion. Anyway, if you look closely at the xmmintrin.h file: on Linux __m128 is a struct. A union, btw, is not a fundamental type. Fundamental types are: float, double, int, etc. .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sergey Kostrov wrote:
If you're interested in class wrappers around SIMD types please take a look at fvec.h and ivec.h header files.
Maybe you want to look at my signature. :) You think I wouldn't know about those classes...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
__m128 data type by design should be mapped directly to XMMn registers so for example the natural component of such a data type is primitive type array.By using union there is the same spot(address) of the memory and only one of those types can be used at same time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My approach is to use custom typedef based on aligned 16 sttructure of double or float arrays.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I already have solved the whole problem. What I was after was to improve the implementation because ICC claims it can do better. So I tried and ICC failed. Which is what I reported.
If you're interested to see how to portably and efficiently access scalar components of SSE/AVX types then look at common/storage.h in Vc (see signature).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are several issues with portability of intrinsics between linux and Windows. Intel compilers mask some but not all, so it seems necessary to test all compilers which are to be supported. Usually there is some least common denominator version which is de facto portable, but the intrinsics clearly aren't portable in the sense of being covered by any standard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page