1 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
2 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
7 // NOTE: This should match the tests in llvm/test/CodeGen/X86/ssse3-intrinsics-fast-isel.ll
9 __m128i
test_mm_abs_epi8(__m128i a
) {
10 // CHECK-LABEL: test_mm_abs_epi8
11 // CHECK: [[ABS:%.*]] = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %{{.*}}, i1 false)
12 return _mm_abs_epi8(a
);
15 __m128i
test_mm_abs_epi16(__m128i a
) {
16 // CHECK-LABEL: test_mm_abs_epi16
17 // CHECK: [[ABS:%.*]] = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %{{.*}}, i1 false)
18 return _mm_abs_epi16(a
);
21 __m128i
test_mm_abs_epi32(__m128i a
) {
22 // CHECK-LABEL: test_mm_abs_epi32
23 // CHECK: [[ABS:%.*]] = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %{{.*}}, i1 false)
24 return _mm_abs_epi32(a
);
27 __m128i
test_mm_alignr_epi8(__m128i a
, __m128i b
) {
28 // CHECK-LABEL: test_mm_alignr_epi8
29 // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i32> <i32 2, i32 3, i32 4, 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>
30 return _mm_alignr_epi8(a
, b
, 2);
33 __m128i
test2_mm_alignr_epi8(__m128i a
, __m128i b
) {
34 // CHECK-LABEL: test2_mm_alignr_epi8
35 // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> zeroinitializer, <16 x i32> <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16>
36 return _mm_alignr_epi8(a
, b
, 17);
39 __m128i
test_mm_hadd_epi16(__m128i a
, __m128i b
) {
40 // CHECK-LABEL: test_mm_hadd_epi16
41 // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
42 return _mm_hadd_epi16(a
, b
);
45 __m128i
test_mm_hadd_epi32(__m128i a
, __m128i b
) {
46 // CHECK-LABEL: test_mm_hadd_epi32
47 // CHECK: call <4 x i32> @llvm.x86.ssse3.phadd.d.128(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
48 return _mm_hadd_epi32(a
, b
);
51 __m128i
test_mm_hadds_epi16(__m128i a
, __m128i b
) {
52 // CHECK-LABEL: test_mm_hadds_epi16
53 // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.sw.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
54 return _mm_hadds_epi16(a
, b
);
57 __m128i
test_mm_hsub_epi16(__m128i a
, __m128i b
) {
58 // CHECK-LABEL: test_mm_hsub_epi16
59 // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.w.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
60 return _mm_hsub_epi16(a
, b
);
63 __m128i
test_mm_hsub_epi32(__m128i a
, __m128i b
) {
64 // CHECK-LABEL: test_mm_hsub_epi32
65 // CHECK: call <4 x i32> @llvm.x86.ssse3.phsub.d.128(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
66 return _mm_hsub_epi32(a
, b
);
69 __m128i
test_mm_hsubs_epi16(__m128i a
, __m128i b
) {
70 // CHECK-LABEL: test_mm_hsubs_epi16
71 // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.sw.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
72 return _mm_hsubs_epi16(a
, b
);
75 __m128i
test_mm_maddubs_epi16(__m128i a
, __m128i b
) {
76 // CHECK-LABEL: test_mm_maddubs_epi16
77 // CHECK: call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
78 return _mm_maddubs_epi16(a
, b
);
81 __m128i
test_mm_mulhrs_epi16(__m128i a
, __m128i b
) {
82 // CHECK-LABEL: test_mm_mulhrs_epi16
83 // CHECK: call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
84 return _mm_mulhrs_epi16(a
, b
);
87 __m128i
test_mm_shuffle_epi8(__m128i a
, __m128i b
) {
88 // CHECK-LABEL: test_mm_shuffle_epi8
89 // CHECK: call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
90 return _mm_shuffle_epi8(a
, b
);
93 __m128i
test_mm_sign_epi8(__m128i a
, __m128i b
) {
94 // CHECK-LABEL: test_mm_sign_epi8
95 // CHECK: call <16 x i8> @llvm.x86.ssse3.psign.b.128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
96 return _mm_sign_epi8(a
, b
);
99 __m128i
test_mm_sign_epi16(__m128i a
, __m128i b
) {
100 // CHECK-LABEL: test_mm_sign_epi16
101 // CHECK: call <8 x i16> @llvm.x86.ssse3.psign.w.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
102 return _mm_sign_epi16(a
, b
);
105 __m128i
test_mm_sign_epi32(__m128i a
, __m128i b
) {
106 // CHECK-LABEL: test_mm_sign_epi32
107 // CHECK: call <4 x i32> @llvm.x86.ssse3.psign.d.128(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
108 return _mm_sign_epi32(a
, b
);