1 // RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - | FileCheck %s
2
3 // Don't include mm_malloc.h, it's system specific.
4 #define __MM_MALLOC_H
5
6 #include <immintrin.h>
7
8 //
9 // Test LLVM IR codegen of cmpXY instructions
10 //
11
test_cmp_pd(__m128d a,__m128d b)12 __m128d test_cmp_pd(__m128d a, __m128d b) {
13 // Expects that the third argument in LLVM IR is immediate expression
14 // CHECK: @llvm.x86.sse2.cmp.pd({{.*}}, i8 13)
15 return _mm_cmp_pd(a, b, _CMP_GE_OS);
16 }
17
test_cmp_ps(__m128 a,__m128 b)18 __m128d test_cmp_ps(__m128 a, __m128 b) {
19 // Expects that the third argument in LLVM IR is immediate expression
20 // CHECK: @llvm.x86.sse.cmp.ps({{.*}}, i8 13)
21 return _mm_cmp_ps(a, b, _CMP_GE_OS);
22 }
23
test_cmp_pd256(__m256d a,__m256d b)24 __m256d test_cmp_pd256(__m256d a, __m256d b) {
25 // Expects that the third argument in LLVM IR is immediate expression
26 // CHECK: @llvm.x86.avx.cmp.pd.256({{.*}}, i8 13)
27 return _mm256_cmp_pd(a, b, _CMP_GE_OS);
28 }
29
test_cmp_ps256(__m256 a,__m256 b)30 __m256d test_cmp_ps256(__m256 a, __m256 b) {
31 // Expects that the third argument in LLVM IR is immediate expression
32 // CHECK: @llvm.x86.avx.cmp.ps.256({{.*}}, i8 13)
33 return _mm256_cmp_ps(a, b, _CMP_GE_OS);
34 }
35
test_cmp_sd(__m128d a,__m128d b)36 __m128d test_cmp_sd(__m128d a, __m128d b) {
37 // Expects that the third argument in LLVM IR is immediate expression
38 // CHECK: @llvm.x86.sse2.cmp.sd({{.*}}, i8 13)
39 return _mm_cmp_sd(a, b, _CMP_GE_OS);
40 }
41
test_cmp_ss(__m128 a,__m128 b)42 __m128d test_cmp_ss(__m128 a, __m128 b) {
43 // Expects that the third argument in LLVM IR is immediate expression
44 // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 13)
45 return _mm_cmp_ss(a, b, _CMP_GE_OS);
46 }
47