[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitabl...
authorCraig Topper <craig.topper@intel.com>
Tue, 10 Jul 2018 00:37:25 +0000 (00:37 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 10 Jul 2018 00:37:25 +0000 (00:37 +0000)
commit638426fc36e08ccee78605a4d8136757ca0faf12
tree10d3c4a1a9bbc0ed4ecb0847c75e6f833b67b698
parente194f73e9f6a101dcb7dba5224c2d4b1fa1b7459
[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitable for use in scalar mask intrinsics.

This will convert the i8 mask argument to <8 x i1> and extract an i1 and then emit a select instruction. This replaces the '(__U & 1)" and ternary operator used in some of intrinsics. The old sequence was lowered to a scalar and and compare. The new sequence uses an i1 vector that will interoperate better with other mask intrinsics.

This removes the need to handle div_ss/sd specially in CGBuiltin.cpp. A follow up patch will add the GCCBuiltin name back in llvm and remove the custom handling.

I made some adjustments to legacy move_ss/sd intrinsics which we reused here to do a simpler extract and insert instead of 2 extracts and two inserts or a shuffle.

llvm-svn: 336622
clang/include/clang/Basic/BuiltinsX86.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/avx512fintrin.h
clang/lib/Headers/emmintrin.h
clang/lib/Headers/xmmintrin.h
clang/test/CodeGen/avx512f-builtins.c
clang/test/CodeGen/sse-builtins.c
clang/test/CodeGen/sse2-builtins.c