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

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

edgarcosta
Beginner
1,129 Views
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
1 Solution
TimP
Honored Contributor III
1,129 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

0 Kudos
4 Replies
TimP
Honored Contributor III
1,129 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.
0 Kudos
edgarcosta
Beginner
1,129 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.
0 Kudos
TimP
Honored Contributor III
1,130 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.
0 Kudos
edgarcosta
Beginner
1,129 Views
Thank you very much
0 Kudos
Reply