Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def =================================================================== --- cfe/trunk/include/clang/Basic/BuiltinsX86.def +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def @@ -2177,6 +2177,14 @@ TARGET_BUILTIN(__builtin_ia32_fpclasspd512_mask, "UcV8dIiUc","","avx512dq") TARGET_BUILTIN(__builtin_ia32_fpclasssd_mask, "UcV2dIiUc","","avx512dq") TARGET_BUILTIN(__builtin_ia32_fpclassss_mask, "UcV4fIiUc","","avx512dq") +TARGET_BUILTIN(__builtin_ia32_kandhi, "UsUsUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_kandnhi, "UsUsUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_korhi, "UsUsUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_kortestchi, "iUsUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_kortestzhi, "iUsUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_kunpckhi, "UsUsUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_kxnorhi, "UsUsUs","","avx512f") +TARGET_BUILTIN(__builtin_ia32_kxorhi, "UsUsUs","","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 @@ -7274,7 +7274,55 @@ __M); } +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm512_kand (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_kandhi ((__mmask16) __A, (__mmask16) __B); +} + +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm512_kandn (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_kandnhi ((__mmask16) __A, (__mmask16) __B); +} + +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm512_kor (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_korhi ((__mmask16) __A, (__mmask16) __B); +} + +static __inline__ int __DEFAULT_FN_ATTRS +_mm512_kortestc (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_kortestchi ((__mmask16) __A, + (__mmask16) __B); +} +static __inline__ int __DEFAULT_FN_ATTRS +_mm512_kortestz (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_kortestzhi ((__mmask16) __A, + (__mmask16) __B); +} + +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm512_kunpackb (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_kunpckhi ((__mmask16) __A, (__mmask16) __B); +} + +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm512_kxnor (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_kxnorhi ((__mmask16) __A, (__mmask16) __B); +} + +static __inline__ __mmask16 __DEFAULT_FN_ATTRS +_mm512_kxor (__mmask16 __A, __mmask16 __B) +{ + return (__mmask16) __builtin_ia32_kxorhi ((__mmask16) __A, (__mmask16) __B); +} #undef __DEFAULT_FN_ATTRS Index: cfe/trunk/test/CodeGen/avx512f-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512f-builtins.c +++ cfe/trunk/test/CodeGen/avx512f-builtins.c @@ -5005,3 +5005,51 @@ // CHECK: @llvm.x86.avx512.mask.permvar.si.512 return _mm512_mask_permutexvar_epi32(__W, __M, __X, __Y); } + +__mmask16 test_mm512_kand(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kand + // CHECK: @llvm.x86.avx512.kand.w + return _mm512_kand(__A, __B); +} + +__mmask16 test_mm512_kandn(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kandn + // CHECK: @llvm.x86.avx512.kandn.w + return _mm512_kandn(__A, __B); +} + +__mmask16 test_mm512_kor(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kor + // CHECK: @llvm.x86.avx512.kor.w + return _mm512_kor(__A, __B); +} + +int test_mm512_kortestc(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kortestc + // CHECK: @llvm.x86.avx512.kortestc.w + return _mm512_kortestc(__A, __B); +} + +int test_mm512_kortestz(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kortestz + // CHECK: @llvm.x86.avx512.kortestz.w + return _mm512_kortestz(__A, __B); +} + +__mmask16 test_mm512_kunpackb(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kunpackb + // CHECK: @llvm.x86.avx512.kunpck.bw + return _mm512_kunpackb(__A, __B); +} + +__mmask16 test_mm512_kxnor(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kxnor + // CHECK: @llvm.x86.avx512.kxnor.w + return _mm512_kxnor(__A, __B); +} + +__mmask16 test_mm512_kxor(__mmask16 __A, __mmask16 __B) { + // CHECK-LABEL: @test_mm512_kxor + // CHECK: @llvm.x86.avx512.kxor.w + return _mm512_kxor(__A, __B); +}