• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
9 // NOTE: This should match the tests in llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
10 
test_mm_cmpestra(__m128i A,int LA,__m128i B,int LB)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);
15 }
16 
test_mm_cmpestrc(__m128i A,int LA,__m128i B,int LB)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);
21 }
22 
test_mm_cmpestri(__m128i A,int LA,__m128i B,int LB)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);
27 }
28 
test_mm_cmpestrm(__m128i A,int LA,__m128i B,int LB)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);
33 }
34 
test_mm_cmpestro(__m128i A,int LA,__m128i B,int LB)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);
39 }
40 
test_mm_cmpestrs(__m128i A,int LA,__m128i B,int LB)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);
45 }
46 
test_mm_cmpestrz(__m128i A,int LA,__m128i B,int LB)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);
51 }
52 
test_mm_cmpgt_epi64(__m128i A,__m128i B)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);
57 }
58 
test_mm_cmpistra(__m128i A,__m128i 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);
63 }
64 
test_mm_cmpistrc(__m128i A,__m128i B)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);
69 }
70 
test_mm_cmpistri(__m128i A,__m128i B)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);
75 }
76 
test_mm_cmpistrm(__m128i A,__m128i B)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);
81 }
82 
test_mm_cmpistro(__m128i A,__m128i B)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);
87 }
88 
test_mm_cmpistrs(__m128i A,__m128i B)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);
93 }
94 
test_mm_cmpistrz(__m128i A,__m128i B)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);
99 }
100 
test_mm_crc32_u8(unsigned int CRC,unsigned char V)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);
105 }
106 
test_mm_crc32_u16(unsigned int CRC,unsigned short 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);
111 }
112 
test_mm_crc32_u32(unsigned int CRC,unsigned int 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);
117 }
118 
test_mm_crc32_u64(unsigned long long CRC,unsigned long long V)119 unsigned long long test_mm_crc32_u64(unsigned long long CRC, unsigned long long V) {
120   // CHECK-LABEL: test_mm_crc32_u64
121   // CHECK: call i64 @llvm.x86.sse42.crc32.64.64(i64 %{{.*}}, i64 %{{.*}})
122   return _mm_crc32_u64(CRC, V);
123 }
124