1 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.2 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
2 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.2 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64
3 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.2 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
4 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.2 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
9 // NOTE: This should match the tests in llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
11 int test_mm_cmpestra(__m128i A
, int LA
, __m128i B
, int LB
) {
12 // CHECK-LABEL: test_mm_cmpestra
13 // CHECK: call i32 @llvm.x86.sse42.pcmpestria128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
14 return _mm_cmpestra(A
, LA
, B
, LB
, 7);
17 int test_mm_cmpestrc(__m128i A
, int LA
, __m128i B
, int LB
) {
18 // CHECK-LABEL: test_mm_cmpestrc
19 // CHECK: call i32 @llvm.x86.sse42.pcmpestric128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
20 return _mm_cmpestrc(A
, LA
, B
, LB
, 7);
23 int test_mm_cmpestri(__m128i A
, int LA
, __m128i B
, int LB
) {
24 // CHECK-LABEL: test_mm_cmpestri
25 // CHECK: call i32 @llvm.x86.sse42.pcmpestri128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
26 return _mm_cmpestri(A
, LA
, B
, LB
, 7);
29 __m128i
test_mm_cmpestrm(__m128i A
, int LA
, __m128i B
, int LB
) {
30 // CHECK-LABEL: test_mm_cmpestrm
31 // CHECK: call <16 x i8> @llvm.x86.sse42.pcmpestrm128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
32 return _mm_cmpestrm(A
, LA
, B
, LB
, 7);
35 int test_mm_cmpestro(__m128i A
, int LA
, __m128i B
, int LB
) {
36 // CHECK-LABEL: test_mm_cmpestro
37 // CHECK: call i32 @llvm.x86.sse42.pcmpestrio128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
38 return _mm_cmpestro(A
, LA
, B
, LB
, 7);
41 int test_mm_cmpestrs(__m128i A
, int LA
, __m128i B
, int LB
) {
42 // CHECK-LABEL: test_mm_cmpestrs
43 // CHECK: call i32 @llvm.x86.sse42.pcmpestris128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
44 return _mm_cmpestrs(A
, LA
, B
, LB
, 7);
47 int test_mm_cmpestrz(__m128i A
, int LA
, __m128i B
, int LB
) {
48 // CHECK-LABEL: test_mm_cmpestrz
49 // CHECK: call i32 @llvm.x86.sse42.pcmpestriz128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
50 return _mm_cmpestrz(A
, LA
, B
, LB
, 7);
53 __m128i
test_mm_cmpgt_epi64(__m128i A
, __m128i B
) {
54 // CHECK-LABEL: test_mm_cmpgt_epi64
55 // CHECK: icmp sgt <2 x i64>
56 return _mm_cmpgt_epi64(A
, B
);
59 int test_mm_cmpistra(__m128i A
, __m128i B
) {
60 // CHECK-LABEL: test_mm_cmpistra
61 // CHECK: call i32 @llvm.x86.sse42.pcmpistria128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
62 return _mm_cmpistra(A
, B
, 7);
65 int test_mm_cmpistrc(__m128i A
, __m128i B
) {
66 // CHECK-LABEL: test_mm_cmpistrc
67 // CHECK: call i32 @llvm.x86.sse42.pcmpistric128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
68 return _mm_cmpistrc(A
, B
, 7);
71 int test_mm_cmpistri(__m128i A
, __m128i B
) {
72 // CHECK-LABEL: test_mm_cmpistri
73 // CHECK: call i32 @llvm.x86.sse42.pcmpistri128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
74 return _mm_cmpistri(A
, B
, 7);
77 __m128i
test_mm_cmpistrm(__m128i A
, __m128i B
) {
78 // CHECK-LABEL: test_mm_cmpistrm
79 // CHECK: call <16 x i8> @llvm.x86.sse42.pcmpistrm128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
80 return _mm_cmpistrm(A
, B
, 7);
83 int test_mm_cmpistro(__m128i A
, __m128i B
) {
84 // CHECK-LABEL: test_mm_cmpistro
85 // CHECK: call i32 @llvm.x86.sse42.pcmpistrio128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
86 return _mm_cmpistro(A
, B
, 7);
89 int test_mm_cmpistrs(__m128i A
, __m128i B
) {
90 // CHECK-LABEL: test_mm_cmpistrs
91 // CHECK: call i32 @llvm.x86.sse42.pcmpistris128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
92 return _mm_cmpistrs(A
, B
, 7);
95 int test_mm_cmpistrz(__m128i A
, __m128i B
) {
96 // CHECK-LABEL: test_mm_cmpistrz
97 // CHECK: call i32 @llvm.x86.sse42.pcmpistriz128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
98 return _mm_cmpistrz(A
, B
, 7);
101 unsigned int test_mm_crc32_u8(unsigned int CRC
, unsigned char V
) {
102 // CHECK-LABEL: test_mm_crc32_u8
103 // CHECK: call i32 @llvm.x86.sse42.crc32.32.8(i32 %{{.*}}, i8 %{{.*}})
104 return _mm_crc32_u8(CRC
, V
);
107 unsigned int test_mm_crc32_u16(unsigned int CRC
, unsigned short V
) {
108 // CHECK-LABEL: test_mm_crc32_u16
109 // CHECK: call i32 @llvm.x86.sse42.crc32.32.16(i32 %{{.*}}, i16 %{{.*}})
110 return _mm_crc32_u16(CRC
, V
);
113 unsigned int test_mm_crc32_u32(unsigned int CRC
, unsigned int V
) {
114 // CHECK-LABEL: test_mm_crc32_u32
115 // CHECK: call i32 @llvm.x86.sse42.crc32.32.32(i32 %{{.*}}, i32 %{{.*}})
116 return _mm_crc32_u32(CRC
, V
);
120 unsigned long long test_mm_crc32_u64(unsigned long long CRC
, unsigned long long V
) {
121 // X64-LABEL: test_mm_crc32_u64
122 // X64: call i64 @llvm.x86.sse42.crc32.64.64(i64 %{{.*}}, i64 %{{.*}})
123 return _mm_crc32_u64(CRC
, V
);