Skip to content

_mm_extract_pi16 and _mm_insert_pi16 warn with -Wvector-conversion #43934

@llvmbot

Description

@llvmbot
Bugzilla Link 44589
Resolution FIXED
Resolved on Feb 12, 2020 05:53
Version 10.0
OS All
Blocks #43900
Attachments Patch to cast the vectors to __v4hi
Reporter LLVM Bugzilla Contributor
CC @topperc,@zmodem,@RKSimon,@zygoloid
Fixed by commit(s) 16b9410

Extended Description

When using either _mm_extract_pi16 or _mm_insert_pi16 with the -Wvector-conversion warning enabled, clang will emit a diagnostic since the builtins used by both functions expect a vector of 4 shorts, but __m64 is a vector of 1 long long.

Here is a trivial test case:

#include <xmmintrin.h>

int16_t extract(__m64 a) {
return _mm_extract_pi16(a, 0);
}

__m64 insert(__m64 a, int d) {
return _mm_insert_pi16(a, d, 0);
}

A patch to simply cast the vectors to __v4hi instead of __m64 (which works for me) is attached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:headersHeaders provided by Clang, e.g. for intrinsics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions