• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -O3 -triple x86_64-apple-macosx10.8.0 -target-feature +sse4.1 -emit-llvm %s -o - | FileCheck %s
2 // FIXME: This test currently depends on optimization - it should be rewritten to avoid it.
3 
4 // Don't include mm_malloc.h, it's system specific.
5 #define __MM_MALLOC_H
6 
7 #include <emmintrin.h>
8 
9 // Byte-shifts look reversed due to xmm register layout
test_mm_slli_si128(__m128 a)10 __m128 test_mm_slli_si128(__m128 a) {
11   // CHECK-LABEL: @test_mm_slli_si128
12   // 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>
13   return _mm_slli_si128(a, 5);
14 }
15 
test_mm_slli_si128_0(__m128 a)16 __m128 test_mm_slli_si128_0(__m128 a) {
17   // CHECK-LABEL: @test_mm_slli_si128_0
18   // CHECK-NOT: shufflevector
19   return _mm_slli_si128(a, 0);
20 }
21 
test_mm_slli_si128_16(__m128 a)22 __m128 test_mm_slli_si128_16(__m128 a) {
23   // CHECK-LABEL: @test_mm_slli_si128_16
24   // CHECK-NOT: shufflevector
25   return _mm_slli_si128(a, 16);
26 }
27 
test_mm_srli_si128(__m128 a)28 __m128 test_mm_srli_si128(__m128 a) {
29   // CHECK-LABEL: @test_mm_srli_si128
30   // 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>
31   return _mm_srli_si128(a, 5);
32 }
33 
test_mm_srli_si128_0(__m128 a)34 __m128 test_mm_srli_si128_0(__m128 a) {
35   // CHECK-LABEL: @test_mm_srli_si128_0
36   // CHECK-NOT: shufflevector
37   return _mm_srli_si128(a, 0);
38 }
39 
test_mm_srli_si128_16(__m128 a)40 __m128 test_mm_srli_si128_16(__m128 a) {
41   // CHECK-LABEL: @test_mm_srli_si128_16
42   // CHECK-NOT: shufflevector
43   return _mm_srli_si128(a, 16);
44 }
45