Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def =================================================================== --- cfe/trunk/include/clang/Basic/BuiltinsX86.def +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def @@ -2222,7 +2222,8 @@ TARGET_BUILTIN(__builtin_ia32_compressdi512_mask, "V8LLiV8LLiV8LLiUc","","avx512f") TARGET_BUILTIN(__builtin_ia32_compresssf512_mask, "V16fV16fV16fUs","","avx512f") TARGET_BUILTIN(__builtin_ia32_compresssi512_mask, "V16iV16iV16iUs","","avx512f") - +TARGET_BUILTIN(__builtin_ia32_cmpsd_mask, "UcV2dV2dIiUcIi","","avx512f") +TARGET_BUILTIN(__builtin_ia32_cmpss_mask, "UcV4fV4fIiUcIi","","avx512f") #undef BUILTIN #undef TARGET_BUILTIN Index: cfe/trunk/lib/Headers/avx512fintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512fintrin.h +++ cfe/trunk/lib/Headers/avx512fintrin.h @@ -7629,6 +7629,58 @@ (__mmask16) __U); } +#define _mm_cmp_round_ss_mask( __X, __Y, __P, __R) __extension__ ({ \ +__builtin_ia32_cmpss_mask ((__v4sf)( __X),\ + (__v4sf)( __Y), __P,\ + (__mmask8) -1, __R);\ +}) + +#define _mm_mask_cmp_round_ss_mask( __M, __X, __Y, __P, __R) __extension__ ({ \ +__builtin_ia32_cmpss_mask ((__v4sf)( __X),\ + (__v4sf)( __Y), __P,\ + (__mmask8)( __M), __R);\ +}) + +#define _mm_cmp_ss_mask( __X, __Y, __P) __extension__ ({ \ +__builtin_ia32_cmpss_mask ((__v4sf)( __X),\ + (__v4sf)( __Y),( __P),\ + (__mmask8) -1,\ + _MM_FROUND_CUR_DIRECTION);\ +}) + +#define _mm_mask_cmp_ss_mask( __M, __X, __Y, __P) __extension__ ({ \ +__builtin_ia32_cmpss_mask ((__v4sf)( __X),\ + (__v4sf)( __Y),( __P),\ + (__mmask8)( __M),\ + _MM_FROUND_CUR_DIRECTION);\ +}) + +#define _mm_cmp_round_sd_mask( __X, __Y, __P,__R) __extension__ ({ \ +__builtin_ia32_cmpsd_mask ((__v2df)( __X),\ + (__v2df)( __Y), __P,\ + (__mmask8) -1, __R);\ +}) + +#define _mm_mask_cmp_round_sd_mask( __M, __X, __Y, __P, __R) __extension__ ({ \ +__builtin_ia32_cmpsd_mask ((__v2df)( __X),\ + (__v2df)( __Y), __P,\ + (__mmask8)( __M), __R);\ +}) + +#define _mm_cmp_sd_mask( __X, __Y, __P) __extension__ ({ \ +__builtin_ia32_cmpsd_mask ((__v2df)( __X),\ + (__v2df)( __Y),( __P),\ + (__mmask8) -1,\ + _MM_FROUND_CUR_DIRECTION);\ +}) + +#define _mm_mask_cmp_sd_mask( __M, __X, __Y, __P) __extension__ ({ \ +__builtin_ia32_cmpsd_mask ((__v2df)( __X),\ + (__v2df)( __Y),( __P),\ + (__mmask8)( __M),\ + _MM_FROUND_CUR_DIRECTION);\ +}) + #undef __DEFAULT_FN_ATTRS #endif // __AVX512FINTRIN_H Index: cfe/trunk/test/CodeGen/avx512f-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512f-builtins.c +++ cfe/trunk/test/CodeGen/avx512f-builtins.c @@ -5285,3 +5285,51 @@ // CHECK: @llvm.x86.avx512.mask.compress.d.512 return _mm512_maskz_compress_epi32(__U, __A); } + +__mmask8 test_mm_cmp_round_ss_mask(__m128 __X, __m128 __Y) { + // CHECK-LABEL: @test_mm_cmp_round_ss_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_cmp_round_ss_mask(__X, __Y, 5, _MM_FROUND_CUR_DIRECTION); +} + +__mmask8 test_mm_mask_cmp_round_ss_mask(__mmask8 __M, __m128 __X, __m128 __Y) { + // CHECK-LABEL: @test_mm_mask_cmp_round_ss_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_mask_cmp_round_ss_mask(__M, __X, __Y, 5, _MM_FROUND_CUR_DIRECTION); +} + +__mmask8 test_mm_cmp_ss_mask(__m128 __X, __m128 __Y) { + // CHECK-LABEL: @test_mm_cmp_ss_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_cmp_ss_mask(__X, __Y, 5); +} + +__mmask8 test_mm_mask_cmp_ss_mask(__mmask8 __M, __m128 __X, __m128 __Y) { + // CHECK-LABEL: @test_mm_mask_cmp_ss_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_mask_cmp_ss_mask(__M, __X, __Y, 5); +} + +__mmask8 test_mm_cmp_round_sd_mask(__m128d __X, __m128d __Y) { + // CHECK-LABEL: @test_mm_cmp_round_sd_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_cmp_round_sd_mask(__X, __Y, 5, _MM_FROUND_CUR_DIRECTION); +} + +__mmask8 test_mm_mask_cmp_round_sd_mask(__mmask8 __M, __m128d __X, __m128d __Y) { + // CHECK-LABEL: @test_mm_mask_cmp_round_sd_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_mask_cmp_round_sd_mask(__M, __X, __Y, 5, _MM_FROUND_CUR_DIRECTION); +} + +__mmask8 test_mm_cmp_sd_mask(__m128d __X, __m128d __Y) { + // CHECK-LABEL: @test_mm_cmp_sd_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_cmp_sd_mask(__X, __Y, 5); +} + +__mmask8 test_mm_mask_cmp_sd_mask(__mmask8 __M, __m128d __X, __m128d __Y) { + // CHECK-LABEL: @test_mm_mask_cmp_sd_mask + // CHECK: @llvm.x86.avx512.mask.cmp + return _mm_mask_cmp_sd_mask(__M, __X, __Y, 5); +}