[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / clang / test / CodeGen / X86 / sse42-builtins.c
blobd0c0cce33e1d0d5bfaaefcf443fe313d29a1dff3
1 // RUN: %clang_cc1 -x c -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 -x c -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 -x c -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 -x c -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
5 // RUN: %clang_cc1 -x c++ -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
6 // RUN: %clang_cc1 -x c++ -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
7 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse4.2 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK
8 // RUN: %clang_cc1 -x c++ -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
11 #include <immintrin.h>
13 // NOTE: This should match the tests in llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
15 int test_mm_cmpestra(__m128i A, int LA, __m128i B, int LB) {
16 // CHECK-LABEL: test_mm_cmpestra
17 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpestria128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
18 return _mm_cmpestra(A, LA, B, LB, 7);
21 int test_mm_cmpestrc(__m128i A, int LA, __m128i B, int LB) {
22 // CHECK-LABEL: test_mm_cmpestrc
23 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpestric128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
24 return _mm_cmpestrc(A, LA, B, LB, 7);
27 int test_mm_cmpestri(__m128i A, int LA, __m128i B, int LB) {
28 // CHECK-LABEL: test_mm_cmpestri
29 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpestri128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
30 return _mm_cmpestri(A, LA, B, LB, 7);
33 __m128i test_mm_cmpestrm(__m128i A, int LA, __m128i B, int LB) {
34 // CHECK-LABEL: test_mm_cmpestrm
35 // CHECK: call <16 x i8> @llvm.x86.sse42.pcmpestrm128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
36 return _mm_cmpestrm(A, LA, B, LB, 7);
39 int test_mm_cmpestro(__m128i A, int LA, __m128i B, int LB) {
40 // CHECK-LABEL: test_mm_cmpestro
41 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpestrio128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
42 return _mm_cmpestro(A, LA, B, LB, 7);
45 int test_mm_cmpestrs(__m128i A, int LA, __m128i B, int LB) {
46 // CHECK-LABEL: test_mm_cmpestrs
47 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpestris128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
48 return _mm_cmpestrs(A, LA, B, LB, 7);
51 int test_mm_cmpestrz(__m128i A, int LA, __m128i B, int LB) {
52 // CHECK-LABEL: test_mm_cmpestrz
53 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpestriz128(<16 x i8> %{{.*}}, i32 %{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
54 return _mm_cmpestrz(A, LA, B, LB, 7);
57 __m128i test_mm_cmpgt_epi64(__m128i A, __m128i B) {
58 // CHECK-LABEL: test_mm_cmpgt_epi64
59 // CHECK: icmp sgt <2 x i64>
60 return _mm_cmpgt_epi64(A, B);
63 int test_mm_cmpistra(__m128i A, __m128i B) {
64 // CHECK-LABEL: test_mm_cmpistra
65 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpistria128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
66 return _mm_cmpistra(A, B, 7);
69 int test_mm_cmpistrc(__m128i A, __m128i B) {
70 // CHECK-LABEL: test_mm_cmpistrc
71 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpistric128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
72 return _mm_cmpistrc(A, B, 7);
75 int test_mm_cmpistri(__m128i A, __m128i B) {
76 // CHECK-LABEL: test_mm_cmpistri
77 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpistri128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
78 return _mm_cmpistri(A, B, 7);
81 __m128i test_mm_cmpistrm(__m128i A, __m128i B) {
82 // CHECK-LABEL: test_mm_cmpistrm
83 // CHECK: call <16 x i8> @llvm.x86.sse42.pcmpistrm128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
84 return _mm_cmpistrm(A, B, 7);
87 int test_mm_cmpistro(__m128i A, __m128i B) {
88 // CHECK-LABEL: test_mm_cmpistro
89 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpistrio128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
90 return _mm_cmpistro(A, B, 7);
93 int test_mm_cmpistrs(__m128i A, __m128i B) {
94 // CHECK-LABEL: test_mm_cmpistrs
95 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpistris128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
96 return _mm_cmpistrs(A, B, 7);
99 int test_mm_cmpistrz(__m128i A, __m128i B) {
100 // CHECK-LABEL: test_mm_cmpistrz
101 // CHECK: call {{.*}}i32 @llvm.x86.sse42.pcmpistriz128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i8 7)
102 return _mm_cmpistrz(A, B, 7);
105 unsigned int test_mm_crc32_u8(unsigned int CRC, unsigned char V) {
106 // CHECK-LABEL: test_mm_crc32_u8
107 // CHECK: call {{.*}}i32 @llvm.x86.sse42.crc32.32.8(i32 %{{.*}}, i8 %{{.*}})
108 return _mm_crc32_u8(CRC, V);
111 unsigned int test_mm_crc32_u16(unsigned int CRC, unsigned short V) {
112 // CHECK-LABEL: test_mm_crc32_u16
113 // CHECK: call {{.*}}i32 @llvm.x86.sse42.crc32.32.16(i32 %{{.*}}, i16 %{{.*}})
114 return _mm_crc32_u16(CRC, V);
117 unsigned int test_mm_crc32_u32(unsigned int CRC, unsigned int V) {
118 // CHECK-LABEL: test_mm_crc32_u32
119 // CHECK: call {{.*}}i32 @llvm.x86.sse42.crc32.32.32(i32 %{{.*}}, i32 %{{.*}})
120 return _mm_crc32_u32(CRC, V);
123 #ifdef __x86_64__
124 unsigned long long test_mm_crc32_u64(unsigned long long CRC, unsigned long long V) {
125 // X64-LABEL: test_mm_crc32_u64
126 // X64: call {{.*}}i64 @llvm.x86.sse42.crc32.64.64(i64 %{{.*}}, i64 %{{.*}})
127 return _mm_crc32_u64(CRC, V);
129 #endif