summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/sse2-builtins.c
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-06-06 00:24:55 +0000
committerCraig Topper <craig.topper@intel.com>2018-06-06 00:24:55 +0000
commitf3914b74c1825f4deece3317542743109dabbf56 (patch)
treec6f2e80811bbed0f4fb57c2fd9f38ff3058ff11c /clang/test/CodeGen/sse2-builtins.c
parentc797bb23b857e4521562073d408be2de8d15a270 (diff)
downloadbcm5719-llvm-f3914b74c1825f4deece3317542743109dabbf56.tar.gz
bcm5719-llvm-f3914b74c1825f4deece3317542743109dabbf56.zip
[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
Diffstat (limited to 'clang/test/CodeGen/sse2-builtins.c')
-rw-r--r--clang/test/CodeGen/sse2-builtins.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/test/CodeGen/sse2-builtins.c b/clang/test/CodeGen/sse2-builtins.c
index f7094b2fbd0..c0a44795bf4 100644
--- a/clang/test/CodeGen/sse2-builtins.c
+++ b/clang/test/CodeGen/sse2-builtins.c
@@ -613,17 +613,15 @@ __m128d test_mm_div_sd(__m128d A, __m128d B) {
// Lowering to pextrw requires optimization.
int test_mm_extract_epi16(__m128i A) {
// CHECK-LABEL: test_mm_extract_epi16
- // CHECK: [[x:%.*]] = and i32 %{{.*}}, 7
- // CHECK: extractelement <8 x i16> %{{.*}}, i32 [[x]]
+ // CHECK: extractelement <8 x i16> %{{.*}}, i32 1
// CHECK: zext i16 %{{.*}} to i32
- return _mm_extract_epi16(A, 9);
+ return _mm_extract_epi16(A, 1);
}
__m128i test_mm_insert_epi16(__m128i A, int B) {
// CHECK-LABEL: test_mm_insert_epi16
- // CHECK: [[x:%.*]] = and i32 %{{.*}}, 7
- // CHECK: insertelement <8 x i16> %{{.*}}, i32 [[x]]
- return _mm_insert_epi16(A, B, 8);
+ // CHECK: insertelement <8 x i16> %{{.*}}, i32 0
+ return _mm_insert_epi16(A, B, 0);
}
void test_mm_lfence() {
OpenPOWER on IntegriCloud