From e71d59fc4f914c24d3d658fe09cdb1ead198b15a Mon Sep 17 00:00:00 2001 From: Michael Zuckerman Date: Mon, 7 Mar 2016 19:15:00 +0000 Subject: [PATCH] [CLANG][AVX512][BUILTIN] Add builtin vcomi{ss|sd} Differential Revision: http://reviews.llvm.org/D17919 llvm-svn: 262847 --- clang/include/clang/Basic/BuiltinsX86.def | 2 ++ clang/lib/Headers/avx512fintrin.h | 8 ++++++++ clang/test/CodeGen/avx512f-builtins.c | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/clang/include/clang/Basic/BuiltinsX86.def b/clang/include/clang/Basic/BuiltinsX86.def index dae1f4a3ebf8..367c238bddeb 100644 --- a/clang/include/clang/Basic/BuiltinsX86.def +++ b/clang/include/clang/Basic/BuiltinsX86.def @@ -1747,6 +1747,8 @@ TARGET_BUILTIN(__builtin_ia32_vpermt2varqi128_mask, "V16cV16cV16cV16cUs","","avx TARGET_BUILTIN(__builtin_ia32_vpermt2varqi128_maskz, "V16cV16cV16cV16cUs","","avx512vbmi,avx512vl") TARGET_BUILTIN(__builtin_ia32_vpermt2varqi256_mask, "V32cV32cV32cV32cUi","","avx512vbmi,avx512vl") TARGET_BUILTIN(__builtin_ia32_vpermt2varqi256_maskz, "V32cV32cV32cV32cUi","","avx512vbmi,avx512vl") +TARGET_BUILTIN(__builtin_ia32_vcomisd, "iV2dV2dIiIi","","avx512f") +TARGET_BUILTIN(__builtin_ia32_vcomiss, "iV4fV4fIiIi","","avx512f") #undef BUILTIN #undef TARGET_BUILTIN diff --git a/clang/lib/Headers/avx512fintrin.h b/clang/lib/Headers/avx512fintrin.h index c1fa73ca7dd6..22a27299e245 100644 --- a/clang/lib/Headers/avx512fintrin.h +++ b/clang/lib/Headers/avx512fintrin.h @@ -3695,6 +3695,14 @@ _mm512_maskz_movedup_pd (__mmask8 __U, __m512d __A) (__mmask8) __U); } +#define _mm_comi_round_sd(__A, __B, __P, __R) __extension__ ({\ +__builtin_ia32_vcomisd ((__v2df) (__A), (__v2df) (__B), ( __P), ( __R));\ +}) + +#define _mm_comi_round_ss( __A, __B, __P, __R) __extension__ ({\ +__builtin_ia32_vcomiss ((__v4sf) (__A), (__v4sf) (__B), ( __P), ( __R));\ +}) + #undef __DEFAULT_FN_ATTRS diff --git a/clang/test/CodeGen/avx512f-builtins.c b/clang/test/CodeGen/avx512f-builtins.c index 0098f3bb089c..27fe962a53f0 100644 --- a/clang/test/CodeGen/avx512f-builtins.c +++ b/clang/test/CodeGen/avx512f-builtins.c @@ -2364,4 +2364,14 @@ __m512d test_mm512_maskz_movedup_pd(__mmask8 __U, __m512d __A) { return _mm512_maskz_movedup_pd(__U, __A); } +int test_mm_comi_round_sd(__m128d __A, __m128d __B) { + // CHECK-LABEL: @test_mm_comi_round_sd + // CHECK: @llvm.x86.avx512.vcomi.sd + return _mm_comi_round_sd(__A, __B, 5, 3); +} +int test_mm_comi_round_ss(__m128 __A, __m128 __B) { + // CHECK-LABEL: @test_mm_comi_round_ss + // CHECK: @llvm.x86.avx512.vcomi.ss + return _mm_comi_round_ss(__A, __B, 5, 3); +}