Community
cancel
Showing results for 
Search instead for 
Did you mean: 
edgarcosta
Beginner
163 Views

__attribute__((mode(TI))) for intel compilers

Jump to solution
Hi,

I was trying to compile a code where I have:
[bash]typedef int int128_t __attribute__((mode(TI))); typedef unsigned int uint128_t __attribute__((mode(TI)));[/bash]
Is there anyway to fix this, usingsomething like
[bash]#ifdef __INTEL_COMPILER && __x86_64[/bash]
so it's compilable with icc?

Thank you in advance
0 Kudos

Accepted Solutions
TimP
Black Belt
163 Views
No one can guess the extent of modifications required to make this change without seeing the source code. This is a typical consequence of using extensions supported by only a few compilers.
At the point of the definition you would simply replace the special gcc data type by one of those present in xmmintrin.h .
#if defined(__INTEL_COMPILER) && defined(__SSE2__)
#include "xmmintrin.h"
__m128 definitions
#elif defined(__GNUC__)
int128_t definitions
#else
take care of other platforms
#endif

xmmintrin.h should be supported by your gcc as well, since you are compiling for x86_64 (you would need -march=pentium4 or such for it to work in 32-bit mode).

I would hate to maintain code which makes a wholesale replacement of int types by compiler-dependent types. icc should support int64_t, in case that helps.

View solution in original post

4 Replies
TimP
Black Belt
163 Views
Until you get a better answer, I think icc supports only the __m128 and __u128 data types for 128-bit objects. I suppose the __INTEL_COMPILER and __SSE2__ predefined macros might be used for conditional compilation to decide which syntax to use. I noticed that __SSE2__ is available in gcc and Open64 C compilers.
edgarcosta
Beginner
163 Views
I don't mind to assume SSE2 and 64bits.

Could you tell me how would you rewrite those lines to use those data types?

I wasn't the one who coded this part and I really don't know much about this kind of stuff.
TimP
Black Belt
164 Views
No one can guess the extent of modifications required to make this change without seeing the source code. This is a typical consequence of using extensions supported by only a few compilers.
At the point of the definition you would simply replace the special gcc data type by one of those present in xmmintrin.h .
#if defined(__INTEL_COMPILER) && defined(__SSE2__)
#include "xmmintrin.h"
__m128 definitions
#elif defined(__GNUC__)
int128_t definitions
#else
take care of other platforms
#endif

xmmintrin.h should be supported by your gcc as well, since you are compiling for x86_64 (you would need -march=pentium4 or such for it to work in 32-bit mode).

I would hate to maintain code which makes a wholesale replacement of int types by compiler-dependent types. icc should support int64_t, in case that helps.

View solution in original post

edgarcosta
Beginner
163 Views
Thank you very much