+2017-01-23 Andrew Senkevich <andrew.senkevich@intel.com>
+
+ * config/i386/avx512bwintrin.h: Add k-mask test, kortest intrinsics.
+ * config/i386/avx512dqintrin.h: Ditto.
+ * config/i386/avx512fintrin.h: Ditto.
+ * gcc/config/i386/i386.c: Handle new builtins.
+ * config/i386/i386-builtin.def: Add new builtins.
+ * config/i386/sse.md (ktest<mode>, kortest<mode>): New.
+ (UNSPEC_KORTEST, UNSPEC_KTEST): New.
+
2017-01-23 Jakub Jelinek <jakub@redhat.com>
Martin Liska <mliska@suse.cz>
now. Remove trailing slash.
2017-01-22 Gerald Pfeifer <gerald@pfeifer.com>
-
+
* README.Portability: Remove note on an Irix compatibility issue.
2017-01-22 Dimitry Andric <dim@FreeBSD.org>
* gcov.c (INCLUDE_ALGORITHM): Define.
(INCLUDE_VECTOR): Define.
No longer include <vector> and <algorithm> directly.
-
+
2017-01-21 Gerald Pfeifer <gerald@pfeifer.com>
* doc/extend.texi (Thread-Local): Change www.akkadia.org reference
typedef unsigned long long __mmask64;
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktest_mask32_u8 (__mmask32 __A, __mmask32 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_ktestcsi (__A, __B);
+ return (unsigned char) __builtin_ia32_ktestzsi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktest_mask64_u8 (__mmask64 __A, __mmask64 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_ktestcdi (__A, __B);
+ return (unsigned char) __builtin_ia32_ktestzdi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestz_mask32_u8 (__mmask32 __A, __mmask32 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestzsi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestz_mask64_u8 (__mmask64 __A, __mmask64 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestzdi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestc_mask32_u8 (__mmask32 __A, __mmask32 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestcsi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestc_mask64_u8 (__mmask64 __A, __mmask64 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestcdi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortest_mask32_u8 (__mmask32 __A, __mmask32 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_kortestcsi (__A, __B);
+ return (unsigned char) __builtin_ia32_kortestzsi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortest_mask64_u8 (__mmask64 __A, __mmask64 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_kortestcdi (__A, __B);
+ return (unsigned char) __builtin_ia32_kortestzdi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestz_mask32_u8 (__mmask32 __A, __mmask32 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestzsi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestz_mask64_u8 (__mmask64 __A, __mmask64 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestzdi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestc_mask32_u8 (__mmask32 __A, __mmask32 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestcsi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestc_mask64_u8 (__mmask64 __A, __mmask64 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestcdi (__A, __B);
+}
+
extern __inline __mmask32
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_kadd_mask32 (__mmask32 __A, __mmask32 __B)
#define __DISABLE_AVX512DQ__
#endif /* __AVX512DQ__ */
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktest_mask8_u8 (__mmask8 __A, __mmask8 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_ktestcqi (__A, __B);
+ return (unsigned char) __builtin_ia32_ktestzqi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestz_mask8_u8 (__mmask8 __A, __mmask8 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestzqi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestc_mask8_u8 (__mmask8 __A, __mmask8 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestcqi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortest_mask8_u8 (__mmask8 __A, __mmask8 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_kortestcqi (__A, __B);
+ return (unsigned char) __builtin_ia32_kortestzqi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestz_mask8_u8 (__mmask8 __A, __mmask8 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestzqi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestc_mask8_u8 (__mmask8 __A, __mmask8 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestcqi (__A, __B);
+}
+
extern __inline __mmask8
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_kadd_mask8 (__mmask8 __A, __mmask8 __B)
#define _kxnor_mask16 _mm512_kxnor
#define _kxor_mask16 _mm512_kxor
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktest_mask16_u8 (__mmask16 __A, __mmask16 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_ktestchi (__A, __B);
+ return (unsigned char) __builtin_ia32_ktestzhi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestz_mask16_u8 (__mmask16 __A, __mmask16 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestzhi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_ktestc_mask16_u8 (__mmask16 __A, __mmask16 __B)
+{
+ return (unsigned char) __builtin_ia32_ktestchi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortest_mask16_u8 (__mmask16 __A, __mmask16 __B, unsigned char *__CF)
+{
+ *__CF = (unsigned char) __builtin_ia32_kortestchi (__A, __B);
+ return (unsigned char) __builtin_ia32_kortestzhi (__A, __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestz_mask16_u8 (__mmask16 __A, __mmask16 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestzhi ((__mmask16) __A,
+ (__mmask16) __B);
+}
+
+extern __inline unsigned char
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kortestc_mask16_u8 (__mmask16 __A, __mmask16 __B)
+{
+ return (unsigned char) __builtin_ia32_kortestchi ((__mmask16) __A,
+ (__mmask16) __B);
+}
+
extern __inline __mmask16
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_kadd_mask16 (__mmask16 __A, __mmask16 __B)
BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kiorhi, "__builtin_ia32_korhi", IX86_BUILTIN_KOR16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kiorsi, "__builtin_ia32_korsi", IX86_BUILTIN_KOR32, UNKNOWN, (int) USI_FTYPE_USI_USI)
BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kiordi, "__builtin_ia32_kordi", IX86_BUILTIN_KOR64, UNKNOWN, (int) UDI_FTYPE_UDI_UDI)
-BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kortestchi, "__builtin_ia32_kortestchi", IX86_BUILTIN_KORTESTC16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
-BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kortestzhi, "__builtin_ia32_kortestzhi", IX86_BUILTIN_KORTESTZ16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
+BDESC (OPTION_MASK_ISA_AVX512DQ, CODE_FOR_ktestqi, "__builtin_ia32_ktestcqi", IX86_BUILTIN_KTESTC8, UNKNOWN, (int) UQI_FTYPE_UQI_UQI)
+BDESC (OPTION_MASK_ISA_AVX512DQ, CODE_FOR_ktestqi, "__builtin_ia32_ktestzqi", IX86_BUILTIN_KTESTZ8, UNKNOWN, (int) UQI_FTYPE_UQI_UQI)
+BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_ktesthi, "__builtin_ia32_ktestchi", IX86_BUILTIN_KTESTC16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
+BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_ktesthi, "__builtin_ia32_ktestzhi", IX86_BUILTIN_KTESTZ16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_ktestsi, "__builtin_ia32_ktestcsi", IX86_BUILTIN_KTESTC32, UNKNOWN, (int) USI_FTYPE_USI_USI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_ktestsi, "__builtin_ia32_ktestzsi", IX86_BUILTIN_KTESTZ32, UNKNOWN, (int) USI_FTYPE_USI_USI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_ktestdi, "__builtin_ia32_ktestcdi", IX86_BUILTIN_KTESTC64, UNKNOWN, (int) UDI_FTYPE_UDI_UDI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_ktestdi, "__builtin_ia32_ktestzdi", IX86_BUILTIN_KTESTZ64, UNKNOWN, (int) UDI_FTYPE_UDI_UDI)
+BDESC (OPTION_MASK_ISA_AVX512DQ, CODE_FOR_kortestqi, "__builtin_ia32_kortestcqi", IX86_BUILTIN_KORTESTC8, UNKNOWN, (int) UQI_FTYPE_UQI_UQI)
+BDESC (OPTION_MASK_ISA_AVX512DQ, CODE_FOR_kortestqi, "__builtin_ia32_kortestzqi", IX86_BUILTIN_KORTESTZ8, UNKNOWN, (int) UQI_FTYPE_UQI_UQI)
+BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kortesthi, "__builtin_ia32_kortestchi", IX86_BUILTIN_KORTESTC16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
+BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kortesthi, "__builtin_ia32_kortestzhi", IX86_BUILTIN_KORTESTZ16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kortestsi, "__builtin_ia32_kortestcsi", IX86_BUILTIN_KORTESTC32, UNKNOWN, (int) USI_FTYPE_USI_USI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kortestsi, "__builtin_ia32_kortestzsi", IX86_BUILTIN_KORTESTZ32, UNKNOWN, (int) USI_FTYPE_USI_USI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kortestdi, "__builtin_ia32_kortestcdi", IX86_BUILTIN_KORTESTC64, UNKNOWN, (int) UDI_FTYPE_UDI_UDI)
+BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kortestdi, "__builtin_ia32_kortestzdi", IX86_BUILTIN_KORTESTZ64, UNKNOWN, (int) UDI_FTYPE_UDI_UDI)
+
BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kunpckhi, "__builtin_ia32_kunpckhi", IX86_BUILTIN_KUNPCKBW, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
BDESC (OPTION_MASK_ISA_AVX512DQ, CODE_FOR_kxnorqi, "__builtin_ia32_kxnorqi", IX86_BUILTIN_KXNOR8, UNKNOWN, (int) UQI_FTYPE_UQI_UQI)
BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kxnorhi, "__builtin_ia32_kxnorhi", IX86_BUILTIN_KXNOR16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
emit_insn (gen_pop (gen_rtx_REG (word_mode, FLAGS_REG)));
return 0;
+ case IX86_BUILTIN_KTESTC8:
+ icode = CODE_FOR_ktestqi;
+ mode0 = QImode;
+ mode1 = CCCmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KTESTZ8:
+ icode = CODE_FOR_ktestqi;
+ mode0 = QImode;
+ mode1 = CCZmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KTESTC16:
+ icode = CODE_FOR_ktesthi;
+ mode0 = HImode;
+ mode1 = CCCmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KTESTZ16:
+ icode = CODE_FOR_ktesthi;
+ mode0 = HImode;
+ mode1 = CCZmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KTESTC32:
+ icode = CODE_FOR_ktestsi;
+ mode0 = SImode;
+ mode1 = CCCmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KTESTZ32:
+ icode = CODE_FOR_ktestsi;
+ mode0 = SImode;
+ mode1 = CCZmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KTESTC64:
+ icode = CODE_FOR_ktestdi;
+ mode0 = DImode;
+ mode1 = CCCmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KTESTZ64:
+ icode = CODE_FOR_ktestdi;
+ mode0 = DImode;
+ mode1 = CCZmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KORTESTC8:
+ icode = CODE_FOR_kortestqi;
+ mode0 = QImode;
+ mode1 = CCCmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KORTESTZ8:
+ icode = CODE_FOR_kortestqi;
+ mode0 = QImode;
+ mode1 = CCZmode;
+ goto kortest;
+
case IX86_BUILTIN_KORTESTC16:
- icode = CODE_FOR_kortestchi;
+ icode = CODE_FOR_kortesthi;
mode0 = HImode;
mode1 = CCCmode;
goto kortest;
case IX86_BUILTIN_KORTESTZ16:
- icode = CODE_FOR_kortestzhi;
+ icode = CODE_FOR_kortesthi;
mode0 = HImode;
mode1 = CCZmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KORTESTC32:
+ icode = CODE_FOR_kortestsi;
+ mode0 = SImode;
+ mode1 = CCCmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KORTESTZ32:
+ icode = CODE_FOR_kortestsi;
+ mode0 = SImode;
+ mode1 = CCZmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KORTESTC64:
+ icode = CODE_FOR_kortestdi;
+ mode0 = DImode;
+ mode1 = CCCmode;
+ goto kortest;
+
+ case IX86_BUILTIN_KORTESTZ64:
+ icode = CODE_FOR_kortestdi;
+ mode0 = DImode;
+ mode1 = CCZmode;
kortest:
arg0 = CALL_EXPR_ARG (exp, 0); /* Mask reg src1. */
;; Mask operations
UNSPEC_MASKOP
+ UNSPEC_KORTEST
+ UNSPEC_KTEST
;; For embed. rounding feature
UNSPEC_EMBEDDED_ROUNDING
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
-;;There are kortrest[bdq] but no intrinsics for them.
-;;We probably don't need to implement them.
-(define_insn "kortestzhi"
- [(set (reg:CCZ FLAGS_REG)
- (compare:CCZ
- (ior:HI
- (match_operand:HI 0 "register_operand" "k")
- (match_operand:HI 1 "register_operand" "k"))
- (const_int 0)))]
- "TARGET_AVX512F && ix86_match_ccmode (insn, CCZmode)"
- "kortestw\t{%1, %0|%0, %1}"
- [(set_attr "mode" "HI")
+(define_insn "ktest<mode>"
+ [(set (reg:CC FLAGS_REG)
+ (unspec:CC
+ [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
+ (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
+ UNSPEC_KTEST))]
+ "TARGET_AVX512F"
+ "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
+ [(set_attr "mode" "<MODE>")
(set_attr "type" "msklog")
(set_attr "prefix" "vex")])
-(define_insn "kortestchi"
- [(set (reg:CCC FLAGS_REG)
- (compare:CCC
- (ior:HI
- (match_operand:HI 0 "register_operand" "k")
- (match_operand:HI 1 "register_operand" "k"))
- (const_int -1)))]
- "TARGET_AVX512F && ix86_match_ccmode (insn, CCCmode)"
- "kortestw\t{%1, %0|%0, %1}"
- [(set_attr "mode" "HI")
+(define_insn "kortest<mode>"
+ [(set (reg:CC FLAGS_REG)
+ (unspec:CC
+ [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
+ (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
+ UNSPEC_KORTEST))]
+ "TARGET_AVX512F"
+ "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
+ [(set_attr "mode" "<MODE>")
(set_attr "type" "msklog")
(set_attr "prefix" "vex")])
+2017-01-23 Andrew Senkevich <andrew.senkevich@intel.com>
+
+ * gcc.target/i386/avx512bw-ktestd-1.c: New test.
+ * gcc.target/i386/avx512bw-ktestq-1.c: Ditto.
+ * gcc.target/i386/avx512dq-ktestb-1.c: Ditto.
+ * gcc.target/i386/avx512f-ktestw-1.c: Ditto.
+ * gcc.target/i386/avx512bw-kortestd-1.c: Ditto.
+ * gcc.target/i386/avx512bw-kortestq-1.c: Ditto.
+ * gcc.target/i386/avx512dq-kortestb-1.c: Ditto.
+ * gcc.target/i386/avx512f-kortestw-1.c: Ditto.
+ * gcc.target/i386/avx512bw-ktestd-2.c: Ditt
+ * gcc.target/i386/avx512bw-ktestq-2.c: Ditto.
+ * gcc.target/i386/avx512dq-ktestb-2.c: Ditto.
+ * gcc.target/i386/avx512f-ktestw-2.c: Ditto.
+ * gcc.target/i386/avx512bw-kortestd-2.c: Ditto.
+ * gcc.target/i386/avx512bw-kortestq-2.c: Ditto.
+ * gcc.target/i386/avx512dq-kortestb-2.c: Ditto.
+ * gcc.target/i386/avx512f-kortestw-2.c: Ditto.
+
2017-01-23 Richard Biener <rguenther@suse.de>
Nick Clifton <nickc@redhat.com>
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512bw" } */
+/* { dg-final { scan-assembler-times "kortestd\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512bw_test () {
+ volatile __mmask32 k1;
+ __mmask32 k2;
+
+ volatile unsigned char r __attribute__((unused));
+
+ r = _kortestc_mask32_u8(k1, k2);
+ r = _kortestz_mask32_u8(k1, k2);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512bw" } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "avx512bw-check.h"
+
+void
+avx512bw_test ()
+{
+ volatile __mmask32 k1, k2;
+ unsigned char r1, r2;
+
+ __asm__( "kmovd %1, %0" : "=k" (k1) : "r" (0) );
+ __asm__( "kmovd %1, %0" : "=k" (k2) : "r" (-1) );
+
+ r1 = _kortest_mask32_u8(k1, k2, &r2);
+
+ if ( r1 != 0 || r2 != 1 )
+ abort ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512bw" } */
+/* { dg-final { scan-assembler-times "kortestq\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512bw_test () {
+ volatile __mmask64 k1;
+ __mmask64 k2;
+
+ volatile unsigned char r __attribute__((unused));
+
+ r = _kortestc_mask64_u8(k1, k2);
+ r = _kortestz_mask64_u8(k1, k2);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512bw" } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "avx512bw-check.h"
+
+void
+avx512bw_test ()
+{
+ __mmask64 k1, k2;
+ unsigned char r1, r2;
+
+ k1 = _cvtu64_mask64(0);
+ k2 = _cvtu64_mask64(-1);
+
+ r1 = _kortest_mask64_u8(k1, k2, &r2);
+
+ if (r1 != 0 || r2 != 1)
+ abort ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512bw" } */
+/* { dg-final { scan-assembler-times "ktestd\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512bw_test () {
+ volatile __mmask32 k1;
+ __mmask32 k2;
+
+ volatile unsigned char r __attribute__((unused));
+
+ r = _ktestc_mask32_u8(k1, k2);
+ r = _ktestz_mask32_u8(k1, k2);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512bw" } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "avx512bw-check.h"
+
+void
+avx512bw_test ()
+{
+ volatile __mmask32 k1, k2;
+ unsigned char r1, r2;
+
+ __asm__( "kmovd %1, %0" : "=k" (k1) : "r" (0) );
+ __asm__( "kmovd %1, %0" : "=k" (k2) : "r" (-1) );
+
+ r1 = _ktest_mask32_u8(k1, k2, &r2);
+
+ if (r1 != 1 || r2 != 0)
+ abort ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512bw" } */
+/* { dg-final { scan-assembler-times "ktestq\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512bw_test () {
+ volatile __mmask64 k1;
+ __mmask64 k2;
+
+ volatile unsigned char r __attribute__((unused));
+
+ r = _ktestc_mask64_u8(k1, k2);
+ r = _ktestz_mask64_u8(k1, k2);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512bw" } */
+/* { dg-require-effective-target avx512bw } */
+
+#include "avx512bw-check.h"
+
+void
+avx512bw_test ()
+{
+ __mmask64 k1, k2;
+ unsigned char r1, r2;
+
+ k1 = _cvtu64_mask64(0);
+ k2 = _cvtu64_mask64(-1);
+
+ r1 = _ktest_mask64_u8(k1, k2, &r2);
+
+ if (r1 != 1 || r2 != 0)
+ abort ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512dq" } */
+/* { dg-final { scan-assembler-times "kortestb\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512dq_test () {
+ volatile __mmask8 k1;
+ __mmask8 k2;
+
+ volatile unsigned char r __attribute__((unused));
+
+ r = _kortestc_mask8_u8(k1, k2);
+ r = _kortestz_mask8_u8(k1, k2);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512dq" } */
+/* { dg-require-effective-target avx512dq } */
+
+#include "avx512dq-check.h"
+
+void
+avx512dq_test ()
+{
+ volatile __mmask8 k1, k2;
+ unsigned char r1, r2;
+
+ __asm__( "kmovb %1, %0" : "=k" (k1) : "r" (0) );
+ __asm__( "kmovb %1, %0" : "=k" (k2) : "r" (-1) );
+
+ r1 = _kortest_mask8_u8(k1, k2, &r2);
+
+ if (r1 != 0 || r2 != 1)
+ abort ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512dq" } */
+/* { dg-final { scan-assembler-times "ktestb\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512dq_test () {
+ volatile __mmask8 k1;
+ __mmask8 k2;
+
+ volatile unsigned char r __attribute__((unused));
+
+ r = _ktestc_mask8_u8(k1, k2);
+ r = _ktestz_mask8_u8(k1, k2);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512dq" } */
+/* { dg-require-effective-target avx512dq } */
+
+#include "avx512dq-check.h"
+
+void
+avx512dq_test ()
+{
+ volatile __mmask8 k1, k2;
+ unsigned char r1, r2;
+
+ __asm__( "kmovb %1, %0" : "=k" (k1) : "r" (0) );
+ __asm__( "kmovb %1, %0" : "=k" (k2) : "r" (-1) );
+
+ r1 = _ktest_mask8_u8(k1, k2, &r2);
+
+ if (r1 != 1 || r2 != 0)
+ abort ();
+}
/* { dg-do compile } */
/* { dg-options "-O0 -mavx512f" } */
-/* { dg-final { scan-assembler-times "kortestw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 4 } } */
+/* { dg-final { scan-assembler-times "kortestw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 6 } } */
#include <immintrin.h>
r = _mm512_kortestc (k3, k4);
r = _mm512_kortestz (k3, k4);
+
+ volatile unsigned char r1 __attribute__((unused));
+
+ r1 = _kortestc_mask16_u8(k1, k2);
+ r1 = _kortestz_mask16_u8(k1, k2);
}
volatile __mmask16 k1;
__mmask16 k2;
volatile short r = 0;
+ volatile unsigned char r1 = 0;
+ unsigned char r2;
/* Test kortestc. */
__asm__( "kmovw %1, %0" : "=k" (k1) : "r" (0) );
r += _mm512_kortestz (k1, k2);
if (!r)
abort ();
+
+ __asm__( "kmovw %1, %0" : "=k" (k1) : "r" (0) );
+ __asm__( "kmovw %1, %0" : "=k" (k2) : "r" (-1) );
+
+ r1 = _kortest_mask16_u8 (k1, k2, &r2);
+ if (r1 != 0 || r2 != 1)
+ abort ();
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512f" } */
+/* { dg-final { scan-assembler-times "ktestw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512f_test () {
+ volatile __mmask16 k1;
+ __mmask16 k2;
+
+ volatile unsigned char r __attribute__((unused));
+
+ r = _ktestc_mask16_u8(k1, k2);
+ r = _ktestz_mask16_u8(k1, k2);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512f" } */
+/* { dg-require-effective-target avx512f } */
+
+#include "avx512f-check.h"
+
+void
+avx512f_test ()
+{
+ volatile __mmask16 k1, k2;
+ unsigned char r1, r2;
+
+ __asm__( "kmovw %1, %0" : "=k" (k1) : "r" (0) );
+ __asm__( "kmovw %1, %0" : "=k" (k2) : "r" (-1) );
+
+ r1 = _ktest_mask16_u8(k1, k2, &r2);
+
+ if (r1 != 1 || r2 != 0)
+ abort ();
+}