Community
cancel
Showing results for 
Search instead for 
Did you mean: 
CFR
Beginner
56 Views

remark #981: operands are evaluated in unspecified order

 

Will someone please educate me on this remark from the C compiler?  In particular:

1) what is it trying to tell me?

2) is it something I should worry about in terms of the integrity of my code?

3) what do I need to do to address it so that I don't get reams of "remarks" when I compiler (I like a nice clean output with no errors, warning, messages, remarks, etc... ;^))

The following shows some code to generate the remark.  It's pared down from a larger code that needs to process a 32bit aligned array that is stored byte swapped (don't blame me, I didn't write that part).  This code is useless, but you'll get the idea.  (It's also all retyped so hopefully I didn't make any typos).

> cat x.c

#include <immintrin.h>

#define BSWAP32(x) _bswap(x)
#define BSWAP128(x) _mm_shuffle_epi8((x), _mm_set_epi32(0x0C0D0E0F, 0x08090A0B, 0x04050607, 0x00010203))

#define 10

int
main(int argc, char *argv[])
{
  unsigned int x[4*N];
  unsigned int y[4*N];

  for (int i=0; i<N; i++) {
    __m128i z = BSWAP128(_mm_lddqu_si128((const __m128i *)&x[i*4]));
    // werk, werk, werk...
    _mm_storeu_si128((__m128i *)&y[i*4], BSWAP(z));
  }

  for (int i=0; i<N; i++) {
    __m128i z = _mm_set_epi32(BSWAP32(x[4*i+3]),BSWAP32(x[4*i+2]),BSWAP32(x[4*i+1]),BSWAP32(x[4*i+0]));
    // werk, werk, werk...
    _mm_storeu_si128((__m128i *)&y[i*4], BSWAP(z));
  }

  for (int i=0; i<N; i++) {
    __m128i xx = _mm_lddqu_si128((const __m128i *)&x[i*4]);
    __m128i z = BSWAP128(xx);
    // werk, werk, werk...
    _mm_storeu_si128((__m128i *)&y[i*4], BSWAP(z));
  }
}

> icc --version
ic (ICC) 15.0.0 20140723
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

> icc -std=c99 -xHost -O3 -w3 x.c
icc: command line remark #10382: option '-xHOST' setting '-xCORE-AVX2'
x.c(16): remark #981: operands are evaluated in unspecified order
    __m128i z = BSWAP128(_mm_lddqu_si128((const __m128i *)&x[i*4]));
                ^

x.c(16): remark #981: operands are evaluated in unspecified order
    __m128i z = BSWAP128(_mm_lddqu_si128((const __m128i *)&x[i*4]));
                ^

x.c(21): remark #981: operands are evaluated in unspecified order
    __m128i z = _mm_set_epi32(BSWAP32(x[4*i+3]),BSWAP32(x[4*i+2]),BSWAP32(x[4*i+1]),BSWAP32(x[4*i+0]));
                                                ^

x.c(21): remark #981: operands are evaluated in unspecified order
    __m128i z = _mm_set_epi32(BSWAP32(x[4*i+3]),BSWAP32(x[4*i+2]),BSWAP32(x[4*i+1]),BSWAP32(x[4*i+0]));
                ^

Anyway, this is something I've never seen before (and only showed up with -w3) so I'd like to understand it better.

0 Kudos
2 Replies
Judith_W_Intel
Employee
56 Views

 

You must be enabling remarks (this remark is not emitted by default):

Here's some helpful posts on this remark:

https://software.intel.com/en-us/forums/intel-c-compiler/topic/287491

https://software.intel.com/en-us/forums/intel-c-compiler/topic/299290

If these don't answer your questions please let us know.

 

 

 

CFR
Beginner
56 Views

Thanks.

Sounds like the message should be something more like "remark #981: Wolf!" ;^).

#pragma warning (disable:981) looks like my best option.