MNN icon indicating copy to clipboard operation
MNN copied to clipboard

fix _mm256_extract_epi64 in msvc2015 and old winsdk

Open futz12 opened this issue 6 months ago • 2 comments

as far as i know, there is no _mm256_extract_epi64 in msvc2015 and old winsdk. so i impl it by hand.

static inline uint64_t _mm256_extract_epi64_fork(__m256i a, const int index)
{
    typedef union {
        __m256i v;
        uint64_t i64[4];
    } extractor;

    extractor u;
    u.v = a;
    
    return u.i64[index];
}

uint64_t copy(uint64_t num) {
    __m256i v;
	v = _mm256_set1_epi64x (num);
	return _mm256_extract_epi64_fork(v, 0);
}

it`s asm in msvc 2015(/O2) is

        vmovq   xmm0, rcx
        vpunpcklqdq xmm0, xmm0, xmm0
        vinsertf128 ymm0, ymm0, xmm0, 1
        vmovq   rax, xmm0
        vzeroupper

in msvc 2017(/O2) is

        vmovq   xmm0, rcx
        vpunpcklqdq xmm0, xmm0, xmm0
        vinsertf128 ymm0, ymm0, xmm0, 1
        vmovq   rax, xmm0
        vzeroupper

vanilla in msvc2017(/O2) is

        vmovq   xmm0, rcx
        vpunpcklqdq xmm0, xmm0, xmm0
        vinsertf128 ymm0, ymm0, xmm0, 1
        vpextrq rax, xmm0, 0
        vzeroupper

futz12 avatar Jun 10 '25 11:06 futz12

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 10 '25 11:06 CLAassistant

#3548

futz12 avatar Jun 10 '25 11:06 futz12

"D:\a\MNN\MNN\source\backend\cpu\x86_x64\avx\GemmInt8.cpp(1549,32): error C2668: '`anonymous-namespace'::_mm256_extract_epi64': ambiguous call to overloaded function"

jxt1234 avatar Jul 23 '25 11:07 jxt1234

Marking as stale. No activity in 60 days.

github-actions[bot] avatar Sep 22 '25 09:09 github-actions[bot]