Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does this compiler message (vectorization, GCC) means?

Using GCC 4.8.1 on previous generation i7 processor with flags:

 -O3 -ftree-vectorizer-verbose=5  -fomit-frame-pointer -DNDEBUG -fno-operator-names -msse2 -mfpmath=sse -march=native -funsafe-math-optimizations -ffast-math

(e.g. all of 'hem!)

I get:

.cpp:31:note: not vectorized: relevant stmt not supported: D.56044_367 = __builtin_logf (D.55726_232);

for the line:

for(i=0;i<N5;i++)   d3[i]=std::log(d2[i]);  

what does this 'error' message mean? (d3 and d2 are vector of floats). Is it hopeless to vectorize the log function?

like image 498
user189035 Avatar asked Mar 27 '14 18:03

user189035


2 Answers

To vectorize means to pack multiple data items into one register and to operate on them in parallel using vector (a.k.a. packed) instructions. Many floating point operations have vector forms, LOG is not one of them. Here's a list of single-precision packed form vector instructions, from http://docs.oracle.com/cd/E19253-01/817-5477/epmoa/index.html

  • ADDPS add packed single-precision floating-point values
  • DIVPS divide packed single-precision floating-point values
  • MAXPS return maximum packed single-precision floating-point values
  • MINPS return minimum packed single-precision floating-point values
  • MULPS multiply packed single-precision floating-point values
  • RCPPS compute reciprocals of packed single-precision floating-point values
  • RSQRTPS compute reciprocals of square roots of packed single-precision floating-point values
  • SQRTPS compute square roots of packed single-precision floating-point values
  • SUBPS subtract packed single-precision floating-point values
like image 102
amdn Avatar answered Oct 12 '22 19:10

amdn


It means that compiler has no SIMD (SSE) instructions to evaluate log.

SIMD instructions allow to evaluate several operations for the price of one so to speak. Log and its relatives typically have no matching hardware instructions.

like image 40
Anycorn Avatar answered Oct 12 '22 20:10

Anycorn