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