Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Mapping between instrinsics and assembly code

$
0
0

 

I'm using unaligned and aligned load intrinsics in my code and ICC does not behave as I expect it to.  If this is expected behavior, can somebody educate me on why?

The fundamental problem is I expect aligned load intrinsics to generate aligned instructions while unaligned intrinsics generate unaligned instructions However, what I see is that depending on compiler flags sometimes aligned load intrinsics generate unaligned instructions. 

I've attached a snippet of code to demonstrate.  I realize this code will segfault when run.  The point is just to compile and and look at the generated assembly code.

There are 3 cases I experimented with (comments in the code give compiler version and detailed compile arguments)

  • gcc - GNU compiler behaves as expected meaning that aligned load intrinsics map to aligned load instructions.
  • icc  with no "-m" argument.  This works exactly like gcc.  Aligned loads map to aligned intrinsics.
  • icc with '-mavx' argument.  (Note gcc requires this argument to even compile the example).  With this argument aligned load intrinsics use unaligned load instructions. The same also happens with '-msse4.2'

 

AdjuntoTamaño
Descargartst_0.c1.42 KB

Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>