diff options
author | John McCall <rjmccall@apple.com> | 2011-06-03 00:02:45 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-06-03 00:02:45 +0000 |
commit | 64d3e89f9b9a25d56aa4a4f77f56656b14d7e03a (patch) | |
tree | 28e339b424408d6cdc31ea433ba445e4888de336 | |
parent | 14ea13cb5af3e9925e141458ab1388daa2ede86d (diff) |
Test case for some AVX builtins. Patch by Syoyo Fujita!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132518 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/CodeGen/avx-cmp-builtins.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/CodeGen/avx-cmp-builtins.c b/test/CodeGen/avx-cmp-builtins.c new file mode 100644 index 0000000000..1ac1c31e2a --- /dev/null +++ b/test/CodeGen/avx-cmp-builtins.c @@ -0,0 +1,46 @@ +// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - | FileCheck %s + +// Don't include mm_malloc.h, it's system specific. +#define __MM_MALLOC_H + +#include <immintrin.h> + +// +// Test LLVM IR codegen of cmpXY instructions +// + +__m128d test_cmp_pd(__m128d a, __m128d b) { + // Expects that the third argument in LLVM IR is immediate expression + // CHECK: @llvm.x86.sse2.cmp.pd({{.*}}, i8 13) + return _mm_cmp_pd(a, b, _CMP_GE_OS); +} + +__m128d test_cmp_ps(__m128 a, __m128 b) { + // Expects that the third argument in LLVM IR is immediate expression + // CHECK: @llvm.x86.sse.cmp.ps({{.*}}, i8 13) + return _mm_cmp_ps(a, b, _CMP_GE_OS); +} + +__m256d test_cmp_pd256(__m256d a, __m256d b) { + // Expects that the third argument in LLVM IR is immediate expression + // CHECK: @llvm.x86.avx.cmp.pd.256({{.*}}, i8 13) + return _mm256_cmp_pd(a, b, _CMP_GE_OS); +} + +__m256d test_cmp_ps256(__m256 a, __m256 b) { + // Expects that the third argument in LLVM IR is immediate expression + // CHECK: @llvm.x86.avx.cmp.ps.256({{.*}}, i8 13) + return _mm256_cmp_ps(a, b, _CMP_GE_OS); +} + +__m128d test_cmp_sd(__m128d a, __m128d b) { + // Expects that the third argument in LLVM IR is immediate expression + // CHECK: @llvm.x86.sse2.cmp.sd({{.*}}, i8 13) + return _mm_cmp_sd(a, b, _CMP_GE_OS); +} + +__m128d test_cmp_ss(__m128 a, __m128 b) { + // Expects that the third argument in LLVM IR is immediate expression + // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 13) + return _mm_cmp_ss(a, b, _CMP_GE_OS); +} |