Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Charles_Martin
Beginner
238 Views

ICC, intrinsics and -O0 compiler errors

Jump to solution
Hi -

I'm using ICC 12.0.0.025 beta to compile some code with lots of SSE2/3 intrinsics. When I try to compile it with no optimizations (-O0 switch), I get these compiiler errs:

filter1d_6_tap32.c(269) (col. 17): catastrophic error: intrinsic parameter must be an immediate value

compilation aborted for filter1d_6_tap32.c (code 4)
filter1d_6_tap.c(292) (col. 17): catastrophic error: intrinsic parameter must be an immediate value

compilation aborted for filter1d_6_tap.c (code 4)
make: *** [icc_objs/filter1d_6_tap32.o] Error 4
make: *** Waiting for unfinished jobs....
filter1d_6_tap_uv.c(307) (col. 17): catastrophic error: intrinsic parameter must be an immediate value

compilation aborted for filter1d_6_tap_uv.c (code 4)
make: *** [icc_objs/filter1d_6_tap_uv.o] Error 4
make: *** [icc_objs/filter1d_6_tap.o] Error 4
filter1d_6_tap32_uv.c(303) (col. 17): catastrophic error: intrinsic parameter must be an immediate value

compilation aborted for filter1d_6_tap32_uv.c (code 4)
make: *** [icc_objs/filter1d_6_tap32_uv.o] Error 4
filter1d_4_tap_uv.c(223) (col. 5): catastrophic error: intrinsic parameter must be an immediate value

compilation aborted for filter1d_4_tap_uv.c (code 4)
make: *** [icc_objs/filter1d_4_tap_uv.o] Error 4
filter1d_4_tap.c(249) (col. 5): catastrophic error: intrinsic parameter must be an immediate value

compilation aborted for filter1d_4_tap.c (code 4)
make: *** [icc_objs/filter1d_4_tap.o] Error 4

I just want to know where I could find information on what this error means...any infos on what I'm doing wrong in this case would be a big bonus too!

Thanks, Charles.
0 Kudos
1 Solution
Thomas_W_Intel
Employee
238 Views

Charles,

If the code compiles fine with optimization enabled, one reason might be that the optimizer finds out that an expression is constant. The compiler can then replace the expression with this constant instead of recomputing it each time. Normally, this is only there to make your code run faster. In case of an intrinsics that requires an "immediate", this results in code that compiles with optimization, but does not compile without optimization.

To my surprise and delight, you can even use the unroll pragma to turn variables into constants and use them as immediate:

[cpp] #include #include const size_t max=1024*1024*1024; char a[max], b[max], c[max]; const int mask[8] = { 1,2,4,8,16,32,64,128 }; int main() { size_t i,j; memset(a,'a',max); memset(b,'b',max); __m128i* as = (__m128i*) a; __m128i* bs = (__m128i*) b; __m128i* cs = (__m128i*) c; for (i=0; i); // constant } } return (int) c[42]; } [/cpp]


Kind regards
Thomas

View solution in original post

5 Replies
Kittur_G_Intel
Employee
238 Views
Hi Charles,

What that diagnostic means is that the intrinsic is expecting the argument to be an "immediate" which is a constant integer (or a literal). So look at the diagnostic and accordingly the line# in the code where it's coming from to correct the error. Also, the intrinsics reference manual should give you more information on the requirements of those intrinsics. In addition, you may also find some macro function(s) that can create constants too, just FYI.

-regards,
Kittur
Kittur_G_Intel
Employee
238 Views
Hi Charles,
Were you able to resolve those intrinsic diagnostic errors?
-thanks,
Kittur
Thomas_W_Intel
Employee
239 Views

Charles,

If the code compiles fine with optimization enabled, one reason might be that the optimizer finds out that an expression is constant. The compiler can then replace the expression with this constant instead of recomputing it each time. Normally, this is only there to make your code run faster. In case of an intrinsics that requires an "immediate", this results in code that compiles with optimization, but does not compile without optimization.

To my surprise and delight, you can even use the unroll pragma to turn variables into constants and use them as immediate:

[cpp] #include #include const size_t max=1024*1024*1024; char a[max], b[max], c[max]; const int mask[8] = { 1,2,4,8,16,32,64,128 }; int main() { size_t i,j; memset(a,'a',max); memset(b,'b',max); __m128i* as = (__m128i*) a; __m128i* bs = (__m128i*) b; __m128i* cs = (__m128i*) c; for (i=0; i); // constant } } return (int) c[42]; } [/cpp]


Kind regards
Thomas

View solution in original post

Kittur_G_Intel
Employee
238 Views
Thanks Thomas, for further elaboration on this issue. Charles, please let us know if the above helps resolve the issue?
_Cheers,
Kittur
Charles_Martin
Beginner
238 Views
It did help! I ended up writing a rather lengthy response, but I suffered a glitch w/ the editor. It seems it does not let me copy/paste text. Yuck! anyway, here's the link to it.
post.txt
Thanks again, Charles.
Reply