Index: include/clang/Basic/BuiltinsX86.def =================================================================== --- include/clang/Basic/BuiltinsX86.def +++ include/clang/Basic/BuiltinsX86.def @@ -1962,6 +1962,8 @@ TARGET_BUILTIN(__builtin_ia32_rsqrt14pd256_mask, "V4dV4dV4dUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_rsqrt14ps128_mask, "V4fV4fV4fUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_rsqrt14ps256_mask, "V8fV8fV8fUc","","avx512vl") +TARGET_BUILTIN(__builtin_ia32_cmpsd_mask, "UcV2dV2dIiUcIi","","avx512f") +TARGET_BUILTIN(__builtin_ia32_cmpss_mask, "UcV4fV4fIiUcIi","","avx512f") #undef BUILTIN #undef TARGET_BUILTIN Index: lib/Headers/avx512fintrin.h =================================================================== --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -5619,6 +5619,58 @@ __R);\ }) +#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: test/CodeGen/avx512f-builtins.c =================================================================== --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -3700,4 +3700,50 @@ return _mm_maskz_sqrt_round_ss(__U,__A,__B,_MM_FROUND_CUR_DIRECTION); } +__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); +}