[X86] Add builtins for vector element insert and extract for different 128 and 256...
authorCraig Topper <craig.topper@intel.com>
Wed, 6 Jun 2018 00:24:55 +0000 (00:24 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 6 Jun 2018 00:24:55 +0000 (00:24 +0000)
commitf3914b74c1825f4deece3317542743109dabbf56
treec6f2e80811bbed0f4fb57c2fd9f38ff3058ff11c
parentc797bb23b857e4521562073d408be2de8d15a270
[X86] Add builtins for vector element insert and extract for different 128 and 256 bit vector types. Use them to implement the extract and insert intrinsics.

Previously we were just using extended vector operations in the header file.

This unfortunately allowed non-constant indices to be used with the intrinsics. This is incompatible with gcc, icc, and MSVC. It also introduces a different performance characteristic because non-constant index gets lowered to a vector store and an element sized load.

By adding the builtins we can check for the index to be a constant and ensure its in range of the vector element count.

User code still has the option to use extended vector operations themselves if they need non-constant indexing.

llvm-svn: 334057
clang/include/clang/Basic/BuiltinsX86.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/avxintrin.h
clang/lib/Headers/emmintrin.h
clang/lib/Headers/smmintrin.h
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/avx-builtins.c
clang/test/CodeGen/sse2-builtins.c
clang/test/CodeGen/sse41-builtins.c
clang/test/CodeGen/target-features-error-2.c
clang/test/CodeGen/vector.c