Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Pritchard__Ben
Beginner
97 Views

Arithmetic operations with KNC intrinsics

I'm working on some simple examples of using the Xeon Phi with intrinsics. Is something like the following supported? Or am I missing something really obvious?

#include "immintrin.h"

int main(int argc, char ** argv)
{
    double arr[8] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
    
    __m512d d1 = _mm512_load_pd(arr);
    __m512d d2 = _mm512_load_pd(arr);
    __m512d d3 = d1 * d2;
    
    return 0;
}

I get the following error with Intel 16.0.2 (and earlier versions):

[user@host mictest]$ icc -mmic -Wall test.c
test.c(9): error: operation not supported for these simd operands
      __m512d d3 = d1 * d2;
                      ^

compilation aborted for test.c (code 2)


 

0 Kudos
3 Replies
jimdempseyatthecove
Black Belt
97 Views

__m512d d3 = _mm512_mul_pd(d1, d2);

Look for the Intrinsics guide

Jim Dempsey

 

Pritchard__Ben
Beginner
97 Views

jimdempseyatthecove wrote:

__m512d d3 = _mm512_mul_pd(d1, d2);

Look for the Intrinsics guide

Jim Dempsey

 

 

Ah maybe I should have been more specific. Yes, I was aware of the various intrinsics. However, I'm porting code that uses AVX __m256d intrinsics with the usual math operators, which works. It would be nice to just have to change the types and leave the rest of the math as is (since it would require lots of messy nested function calls, and the code is quite extensive).

CFR
Beginner
97 Views

I vaguely remember from the Intel compiler Beta webinar May 2015 that the use of arithmetic operators (and the class libraries) were not consistent/supported across all the data types.  At that time I believe on 128 and 256 bit types were supported for arithmetic ops.  Class libraries for 64 (ivec) and 128 (dvec) were supported, but I didn't get an answer as to when 256 (qvec) and 512 (not just micvec) would be updated.  This applied to the 2016 Beta and at least the first release of the 2016 tools, so I'm not sure if the latest and greatest updates has fixed things.

Reply