https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83250

Agner Fog <agner at agner dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |agner at agner dot org

--- Comment #1 from Agner Fog <agner at agner dot org> ---
I can confirm this bug.

_mm256_zextsi128_si256 and several similar intrinsic functions are supported by
Clang and MS compilers, but not by Gcc.

Test case:

   #include <x86intrin.h> 

   __m256i zero_upper_part(__m256i a) {
       return _mm256_zextsi128_si256(_mm256_castsi256_si128(a));
   }

Result:
test.cpp: In function '__m256i zero_upper_part(__m256i)':
test.cpp:6:12: error: '_mm256_zextsi128_si256' was not declared in this scope
     return _mm256_zextsi128_si256(_mm256_castsi256_si128(a));
            ^~~~~~~~~~~~~~~~~~~~~~
test.cpp:6:12: note: suggested alternative: '_mm256_castsi128_si256'


The suggested alternative is *dangerous*: The upper part of the ymm register is
undefined after _mm256_castsi128_si256, while it is zero after
_mm256_zextsi128_si256.

_mm256_castsi128_si256 works most of the time, but sometimes a compiler will
optimize away the undefined upper part so that it no longer zero. This can give
some nasty bugs.

Reply via email to