[cfe-users] Error calling _mm256_cvtps_ph intrinsic on Windows

degski via cfe-users cfe-users at lists.llvm.org
Wed Apr 11 08:40:07 PDT 2018


When calling the _mm256_cvtps_ph instruction [1] using Clang [2] the
following error manifests itself:

1>------ Build started: Project: CRoaringTest, Configuration: Debug x64
------
1>main.c(19): error : '__builtin_ia32_vcvtps2ph256' needs target feature
f16c
1>C:\Program Files\LLVM\lib\clang\7.0.0\include\immintrin.h(100):  note:
expanded from macro '_mm256_cvtps_ph'
1>Done building project "CRoaringTest.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I'm trying to call the following function:

__declspec ( noinline ) void float2half ( float * floats, short * halfs ) {

    _mm_store_si128 ( ( __m128i* ) halfs, _mm256_cvtps_ph ( _mm256_load_ps
( floats ), 0 ) );
}

int main () {

    float test [ 8 ] = { -0.0f, -1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
    short rest [ 8 ] = { 0 };

    float2half ( test, rest );

    for ( int32_t i = 0; i < 8; ++i ) {

        printf ( "%i ", ( int ) rest [ i ] );
    }

    printf ( "\n" );

    return 0;
}


I have a Broadwell CPU (i.e. it should work) and VS 15.6.6 compiles this
just fine. In Debug the error is shown as per above, in Release, no error,
but crashes.

degski

[1]
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_cvtps_ph&expand=1711
[2] http://prereleases.llvm.org/win-snapshots/LLVM-7.0.0-r325576-win64.exe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20180411/d78f7b8b/attachment.html>


More information about the cfe-users mailing list