Visual Studio 2017: _mm_load_ps is often compiled into movups

I am reviewing the generated assembly for my code (using Visual Studio 2017) and noticed that _mm_load_ps is often (always?) Compiled for movups.

The data that I use _mm_load_ps is defined as follows:

struct alignas(16) Vector {
    float v[4];
}

// often embedded in other structs like this
struct AABB {
    Vector min;
    Vector max;
    bool intersection(/* parameters */) const;
}

Now, when I use this construct, the following will happen:

// this code
__mm128 bb_min = _mm_load_ps(min.v);

// generates this
movups  xmm4, XMMWORD PTR [r8]

I expect movaps due to alignas (16). Do I need anything else to convince the compiler to use movaps in this case?

EDIT: , . , . , , _mm_load_ps ( ) movups. , , *, movaps, ?

+5
1

Visual Studio Intel Compiler ( 2013 ?) - SIMD-/.

AVX :

  • Microsoft (> VS2013?) . .
  • Intel (> Parallel Studio 2012?) . ICC , memset().
  • GCC 6.1, /, .

, . , Nehalem, / .

Microsoft , " ". , Microsoft. , , . .

/ .

:

  • Parallel Studio 2018, Intel - Nehalem.
  • Visual Studio 2017, Microsoft Compiler - AVX.

. , , Intel Microsoft .


/, , - /. , .

, , load/store . , - , NT load/stores ( , NT-) - , , , .

+6

Source: https://habr.com/ru/post/1671895/


All Articles