1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Werror | FileCheck %s
2
3// Don't include mm_malloc.h, it's system specific.
4#define __MM_MALLOC_H
5
6#include <x86intrin.h>
7
8__m128i test_mm_abs_epi8(__m128i a) {
9  // CHECK-LABEL: test_mm_abs_epi8
10  // CHECK: call <16 x i8> @llvm.x86.ssse3.pabs.b.128
11  return _mm_abs_epi8(a);
12}
13
14__m128i test_mm_abs_epi16(__m128i a) {
15  // CHECK-LABEL: test_mm_abs_epi16
16  // CHECK: call <8 x i16> @llvm.x86.ssse3.pabs.w.128
17  return _mm_abs_epi16(a);
18}
19
20__m128i test_mm_abs_epi32(__m128i a) {
21  // CHECK-LABEL: test_mm_abs_epi32
22  // CHECK: call <4 x i32> @llvm.x86.ssse3.pabs.d.128
23  return _mm_abs_epi32(a);
24}
25
26__m128i test_mm_alignr_epi8(__m128i a, __m128i b) {
27  // CHECK-LABEL: test_mm_alignr_epi8
28  // 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>
29  return _mm_alignr_epi8(a, b, 2);
30}
31
32__m128i test2_mm_alignr_epi8(__m128i a, __m128i b) {
33  // CHECK-LABEL: test2_mm_alignr_epi8
34  // 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>
35  return _mm_alignr_epi8(a, b, 17);
36}
37
38__m128i test_mm_hadd_epi16(__m128i a, __m128i b) {
39  // CHECK-LABEL: test_mm_hadd_epi16
40  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.w.128
41  return _mm_hadd_epi16(a, b);
42}
43
44__m128i test_mm_hadd_epi32(__m128i a, __m128i b) {
45  // CHECK-LABEL: test_mm_hadd_epi32
46  // CHECK: call <4 x i32> @llvm.x86.ssse3.phadd.d.128
47  return _mm_hadd_epi32(a, b);
48}
49
50__m128i test_mm_hadds_epi16(__m128i a, __m128i b) {
51  // CHECK-LABEL: test_mm_hadds_epi16
52  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.sw.128
53  return _mm_hadds_epi16(a, b);
54}
55
56__m128i test_mm_hsub_epi16(__m128i a, __m128i b) {
57  // CHECK-LABEL: test_mm_hsub_epi16
58  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.w.128
59  return _mm_hsub_epi16(a, b);
60}
61
62__m128i test_mm_hsub_epi32(__m128i a, __m128i b) {
63  // CHECK-LABEL: test_mm_hsub_epi32
64  // CHECK: call <4 x i32> @llvm.x86.ssse3.phsub.d.128
65  return _mm_hsub_epi32(a, b);
66}
67
68__m128i test_mm_hsubs_epi16(__m128i a, __m128i b) {
69  // CHECK-LABEL: test_mm_hsubs_epi16
70  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.sw.128
71  return _mm_hsubs_epi16(a, b);
72}
73
74__m128i test_mm_maddubs_epi16(__m128i a, __m128i b) {
75  // CHECK-LABEL: test_mm_maddubs_epi16
76  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128
77  return _mm_maddubs_epi16(a, b);
78}
79
80__m128i test_mm_mulhrs_epi16(__m128i a, __m128i b) {
81  // CHECK-LABEL: test_mm_mulhrs_epi16
82  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128
83  return _mm_mulhrs_epi16(a, b);
84}
85
86__m128i test_mm_shuffle_epi8(__m128i a, __m128i b) {
87  // CHECK-LABEL: test_mm_shuffle_epi8
88  // CHECK: call <16 x i8> @llvm.x86.ssse3.pshuf.b.128
89  return _mm_shuffle_epi8(a, b);
90}
91
92__m128i test_mm_sign_epi8(__m128i a, __m128i b) {
93  // CHECK-LABEL: test_mm_sign_epi8
94  // CHECK: call <16 x i8> @llvm.x86.ssse3.psign.b.128
95  return _mm_sign_epi8(a, b);
96}
97
98__m128i test_mm_sign_epi16(__m128i a, __m128i b) {
99  // CHECK-LABEL: test_mm_sign_epi16
100  // CHECK: call <8 x i16> @llvm.x86.ssse3.psign.w.128
101  return _mm_sign_epi16(a, b);
102}
103
104__m128i test_mm_sign_epi32(__m128i a, __m128i b) {
105  // CHECK-LABEL: test_mm_sign_epi32
106  // CHECK: call <4 x i32> @llvm.x86.ssse3.psign.d.128
107  return _mm_sign_epi32(a, b);
108}
109