1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +sse4.2 -emit-llvm -o - -Werror | FileCheck %s
2 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +sse4.2 -fno-signed-char -emit-llvm -o - -Werror | FileCheck %s
3
4 // Don't include mm_malloc.h, it's system specific.
5 #define __MM_MALLOC_H
6
7 #include <x86intrin.h>
8
test_mm_cmpgt_epi8(__m128i A,__m128i B)9 __m128i test_mm_cmpgt_epi8(__m128i A, __m128i B) {
10 // CHECK-LABEL: test_mm_cmpgt_epi8
11 // CHECK: icmp sgt <16 x i8>
12 return _mm_cmpgt_epi8(A, B);
13 }
14
test_mm_cmpgt_epi16(__m128i A,__m128i B)15 __m128i test_mm_cmpgt_epi16(__m128i A, __m128i B) {
16 // CHECK-LABEL: test_mm_cmpgt_epi16
17 // CHECK: icmp sgt <8 x i16>
18 return _mm_cmpgt_epi16(A, B);
19 }
20
test_mm_cmpgt_epi32(__m128i A,__m128i B)21 __m128i test_mm_cmpgt_epi32(__m128i A, __m128i B) {
22 // CHECK-LABEL: test_mm_cmpgt_epi32
23 // CHECK: icmp sgt <4 x i32>
24 return _mm_cmpgt_epi32(A, B);
25 }
26
test_mm_cmpgt_epi64(__m128i A,__m128i B)27 __m128i test_mm_cmpgt_epi64(__m128i A, __m128i B) {
28 // CHECK-LABEL: test_mm_cmpgt_epi64
29 // CHECK: icmp sgt <2 x i64>
30 return _mm_cmpgt_epi64(A, B);
31 }
32
test_mm_cmpestra(__m128i A,int LA,__m128i B,int LB)33 int test_mm_cmpestra(__m128i A, int LA, __m128i B, int LB) {
34 // CHECK-LABEL: test_mm_cmpestra
35 // CHECK: @llvm.x86.sse42.pcmpestria128
36 return _mm_cmpestra(A, LA, B, LB, 7);
37 }
38
test_mm_cmpestrc(__m128i A,int LA,__m128i B,int LB)39 int test_mm_cmpestrc(__m128i A, int LA, __m128i B, int LB) {
40 // CHECK-LABEL: test_mm_cmpestrc
41 // CHECK: @llvm.x86.sse42.pcmpestric128
42 return _mm_cmpestrc(A, LA, B, LB, 7);
43 }
44
test_mm_cmpestri(__m128i A,int LA,__m128i B,int LB)45 int test_mm_cmpestri(__m128i A, int LA, __m128i B, int LB) {
46 // CHECK-LABEL: test_mm_cmpestri
47 // CHECK: @llvm.x86.sse42.pcmpestri128
48 return _mm_cmpestri(A, LA, B, LB, 7);
49 }
50
test_mm_cmpestrm(__m128i A,int LA,__m128i B,int LB)51 __m128i test_mm_cmpestrm(__m128i A, int LA, __m128i B, int LB) {
52 // CHECK-LABEL: test_mm_cmpestrm
53 // CHECK: @llvm.x86.sse42.pcmpestrm128
54 return _mm_cmpestrm(A, LA, B, LB, 7);
55 }
56
test_mm_cmpestro(__m128i A,int LA,__m128i B,int LB)57 int test_mm_cmpestro(__m128i A, int LA, __m128i B, int LB) {
58 // CHECK-LABEL: test_mm_cmpestro
59 // CHECK: @llvm.x86.sse42.pcmpestrio128
60 return _mm_cmpestro(A, LA, B, LB, 7);
61 }
62
test_mm_cmpestrs(__m128i A,int LA,__m128i B,int LB)63 int test_mm_cmpestrs(__m128i A, int LA, __m128i B, int LB) {
64 // CHECK-LABEL: test_mm_cmpestrs
65 // CHECK: @llvm.x86.sse42.pcmpestris128
66 return _mm_cmpestrs(A, LA, B, LB, 7);
67 }
68
test_mm_cmpestrz(__m128i A,int LA,__m128i B,int LB)69 int test_mm_cmpestrz(__m128i A, int LA, __m128i B, int LB) {
70 // CHECK-LABEL: test_mm_cmpestrz
71 // CHECK: @llvm.x86.sse42.pcmpestriz128
72 return _mm_cmpestrz(A, LA, B, LB, 7);
73 }
74
test_mm_cmpistra(__m128i A,__m128i B)75 int test_mm_cmpistra(__m128i A, __m128i B) {
76 // CHECK-LABEL: test_mm_cmpistra
77 // CHECK: @llvm.x86.sse42.pcmpistria128
78 return _mm_cmpistra(A, B, 7);
79 }
80
test_mm_cmpistrc(__m128i A,__m128i B)81 int test_mm_cmpistrc(__m128i A, __m128i B) {
82 // CHECK-LABEL: test_mm_cmpistrc
83 // CHECK: @llvm.x86.sse42.pcmpistric128
84 return _mm_cmpistrc(A, B, 7);
85 }
86
test_mm_cmpistri(__m128i A,__m128i B)87 int test_mm_cmpistri(__m128i A, __m128i B) {
88 // CHECK-LABEL: test_mm_cmpistri
89 // CHECK: @llvm.x86.sse42.pcmpistri128
90 return _mm_cmpistri(A, B, 7);
91 }
92
test_mm_cmpistrm(__m128i A,__m128i B)93 __m128i test_mm_cmpistrm(__m128i A, __m128i B) {
94 // CHECK-LABEL: test_mm_cmpistrm
95 // CHECK: @llvm.x86.sse42.pcmpistrm128
96 return _mm_cmpistrm(A, B, 7);
97 }
98
test_mm_cmpistro(__m128i A,__m128i B)99 int test_mm_cmpistro(__m128i A, __m128i B) {
100 // CHECK-LABEL: test_mm_cmpistro
101 // CHECK: @llvm.x86.sse42.pcmpistrio128
102 return _mm_cmpistro(A, B, 7);
103 }
104
test_mm_cmpistrs(__m128i A,__m128i B)105 int test_mm_cmpistrs(__m128i A, __m128i B) {
106 // CHECK-LABEL: test_mm_cmpistrs
107 // CHECK: @llvm.x86.sse42.pcmpistris128
108 return _mm_cmpistrs(A, B, 7);
109 }
110
test_mm_cmpistrz(__m128i A,__m128i B)111 int test_mm_cmpistrz(__m128i A, __m128i B) {
112 // CHECK-LABEL: test_mm_cmpistrz
113 // CHECK: @llvm.x86.sse42.pcmpistriz128
114 return _mm_cmpistrz(A, B, 7);
115 }
116
test_mm_crc32_u8(unsigned int CRC,unsigned char V)117 unsigned int test_mm_crc32_u8(unsigned int CRC, unsigned char V) {
118 // CHECK-LABEL: test_mm_crc32_u8
119 // CHECK: call i32 @llvm.x86.sse42.crc32.32.8
120 return _mm_crc32_u8(CRC, V);
121 }
122
test_mm_crc32_u16(unsigned int CRC,unsigned short V)123 unsigned int test_mm_crc32_u16(unsigned int CRC, unsigned short V) {
124 // CHECK-LABEL: test_mm_crc32_u16
125 // CHECK: call i32 @llvm.x86.sse42.crc32.32.16
126 return _mm_crc32_u16(CRC, V);
127 }
128
test_mm_crc32_u32(unsigned int CRC,unsigned int V)129 unsigned int test_mm_crc32_u32(unsigned int CRC, unsigned int V) {
130 // CHECK-LABEL: test_mm_crc32_u32
131 // CHECK: call i32 @llvm.x86.sse42.crc32.32.32
132 return _mm_crc32_u32(CRC, V);
133 }
134
test_mm_crc32_u64(unsigned long long CRC,unsigned long long V)135 unsigned int test_mm_crc32_u64(unsigned long long CRC, unsigned long long V) {
136 // CHECK-LABEL: test_mm_crc32_u64
137 // CHECK: call i64 @llvm.x86.sse42.crc32.64.64
138 return _mm_crc32_u64(CRC, V);
139 }
140