summaryrefslogtreecommitdiff
path: root/test/CodeGen/sse.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
commit5e20cdd81c44a443562a09007668ffdf76c455af (patch)
treedbbd4047878da71c1a706e26ce05b4e7791b14cc /test/CodeGen/sse.c
parentd5f23b0b7528b5c3caed1ba14f897cc4aaa9e3c3 (diff)
downloadsrc-test2-5e20cdd81c44a443562a09007668ffdf76c455af.tar.gz
src-test2-5e20cdd81c44a443562a09007668ffdf76c455af.zip
Notes
Diffstat (limited to 'test/CodeGen/sse.c')
-rw-r--r--test/CodeGen/sse.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/CodeGen/sse.c b/test/CodeGen/sse.c
new file mode 100644
index 000000000000..17cce69d8466
--- /dev/null
+++ b/test/CodeGen/sse.c
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -O3 -ffreestanding -triple x86_64-apple-macosx10.8.0 -target-feature +sse4.1 -emit-llvm %s -o - | FileCheck %s
+
+#include <emmintrin.h>
+
+// Byte-shifts look reversed due to xmm register layout
+__m128 test_mm_slli_si128(__m128 a) {
+ // CHECK-LABEL: @test_mm_slli_si128
+ // CHECK: shufflevector <16 x i8> <{{.*}}, i8 0, i8 0, i8 0, i8 0, i8 0>, <16 x i8> {{.*}}, <16 x i32> <i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26>
+ return _mm_slli_si128(a, 5);
+}
+
+__m128 test_mm_slli_si128_0(__m128 a) {
+ // CHECK-LABEL: @test_mm_slli_si128_0
+ // CHECK-NOT: shufflevector
+ return _mm_slli_si128(a, 0);
+}
+
+__m128 test_mm_slli_si128_16(__m128 a) {
+ // CHECK-LABEL: @test_mm_slli_si128_16
+ // CHECK-NOT: shufflevector
+ return _mm_slli_si128(a, 16);
+}
+
+__m128 test_mm_srli_si128(__m128 a) {
+ // CHECK-LABEL: @test_mm_srli_si128
+ // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, {{.*}}>, <16 x i32> <i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20>
+ return _mm_srli_si128(a, 5);
+}
+
+__m128 test_mm_srli_si128_0(__m128 a) {
+ // CHECK-LABEL: @test_mm_srli_si128_0
+ // CHECK-NOT: shufflevector
+ return _mm_srli_si128(a, 0);
+}
+
+__m128 test_mm_srli_si128_16(__m128 a) {
+ // CHECK-LABEL: @test_mm_srli_si128_16
+ // CHECK-NOT: shufflevector
+ return _mm_srli_si128(a, 16);
+}