2016-09-28 19:59:09 +08:00
|
|
|
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.2 -emit-llvm -o - -Wall -Werror | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.2 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s
|
2015-09-06 22:05:33 +08:00
|
|
|
|
|
|
|
|
2018-05-24 15:09:08 +08:00
|
|
|
#include <immintrin.h>
|
2015-09-06 22:05:33 +08:00
|
|
|
|
2016-05-18 22:29:55 +08:00
|
|
|
// NOTE: This should match the tests in llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
|
2015-09-06 22:05:33 +08:00
|
|
|
|
|
|
|
int test_mm_cmpestra(__m128i A, int LA, __m128i B, int LB) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpestra
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpestria128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpestra(A, LA, B, LB, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpestrc(__m128i A, int LA, __m128i B, int LB) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpestrc
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpestric128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpestrc(A, LA, B, LB, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpestri(__m128i A, int LA, __m128i B, int LB) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpestri
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpestri128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpestri(A, LA, B, LB, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128i test_mm_cmpestrm(__m128i A, int LA, __m128i B, int LB) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpestrm
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call <16 x i8> @llvm.x86.sse42.pcmpestrm128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpestrm(A, LA, B, LB, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpestro(__m128i A, int LA, __m128i B, int LB) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpestro
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpestrio128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpestro(A, LA, B, LB, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpestrs(__m128i A, int LA, __m128i B, int LB) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpestrs
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpestris128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpestrs(A, LA, B, LB, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpestrz(__m128i A, int LA, __m128i B, int LB) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpestrz
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpestriz128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpestrz(A, LA, B, LB, 7);
|
|
|
|
}
|
|
|
|
|
2016-05-18 22:29:55 +08:00
|
|
|
__m128i test_mm_cmpgt_epi64(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpgt_epi64
|
|
|
|
// CHECK: icmp sgt <2 x i64>
|
|
|
|
return _mm_cmpgt_epi64(A, B);
|
|
|
|
}
|
|
|
|
|
2015-09-06 22:05:33 +08:00
|
|
|
int test_mm_cmpistra(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpistra
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpistria128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpistra(A, B, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpistrc(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpistrc
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpistric128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpistrc(A, B, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpistri(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpistri
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpistri128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpistri(A, B, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128i test_mm_cmpistrm(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpistrm
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call <16 x i8> @llvm.x86.sse42.pcmpistrm128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpistrm(A, B, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpistro(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpistro
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpistrio128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpistro(A, B, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpistrs(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpistrs
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpistris128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpistrs(A, B, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_mm_cmpistrz(__m128i A, __m128i B) {
|
|
|
|
// CHECK-LABEL: test_mm_cmpistrz
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.pcmpistriz128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_cmpistrz(A, B, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int test_mm_crc32_u8(unsigned int CRC, unsigned char V) {
|
|
|
|
// CHECK-LABEL: test_mm_crc32_u8
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.crc32.32.8(i32 %{{.*}}, i8 %{{.*}})
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_crc32_u8(CRC, V);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int test_mm_crc32_u16(unsigned int CRC, unsigned short V) {
|
|
|
|
// CHECK-LABEL: test_mm_crc32_u16
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.crc32.32.16(i32 %{{.*}}, i16 %{{.*}})
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_crc32_u16(CRC, V);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int test_mm_crc32_u32(unsigned int CRC, unsigned int V) {
|
|
|
|
// CHECK-LABEL: test_mm_crc32_u32
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i32 @llvm.x86.sse42.crc32.32.32(i32 %{{.*}}, i32 %{{.*}})
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_crc32_u32(CRC, V);
|
|
|
|
}
|
|
|
|
|
2019-07-11 01:11:23 +08:00
|
|
|
#ifdef __x86_64__
|
2016-05-18 22:29:55 +08:00
|
|
|
unsigned long long test_mm_crc32_u64(unsigned long long CRC, unsigned long long V) {
|
2015-09-06 22:05:33 +08:00
|
|
|
// CHECK-LABEL: test_mm_crc32_u64
|
2016-05-18 22:29:55 +08:00
|
|
|
// CHECK: call i64 @llvm.x86.sse42.crc32.64.64(i64 %{{.*}}, i64 %{{.*}})
|
2015-09-06 22:05:33 +08:00
|
|
|
return _mm_crc32_u64(CRC, V);
|
|
|
|
}
|
2019-07-11 01:11:23 +08:00
|
|
|
#endif
|