+2017-01-26 Jakub Jelinek <jakub@redhat.com>
+
+ * config/i386/avx512fintrin.h (_ktest_mask16_u8,
+ _ktestz_mask16_u8, _ktestc_mask16_u8, _kadd_mask16): Move to ...
+ * config/i386/avx512dqintrin.h (_ktest_mask16_u8,
+ _ktestz_mask16_u8, _ktestc_mask16_u8, _kadd_mask16): ... here.
+ * config/i386/i386-builtin.def (__builtin_ia32_ktestchi,
+ __builtin_ia32_ktestzhi, __builtin_ia32_kaddhi): Use
+ OPTION_MASK_ISA_AVX512DQ instead of OPTION_MASK_ISA_AVX512F.
+ * config/i386/sse.md (SWI1248_AVX512BWDQ2): New mode iterator.
+ (kadd<mode>, ktest<mode>): Use it instead of SWI1248_AVX512BWDQ.
+
2017-01-26 Marek Polacek <polacek@redhat.com>
PR c/79199
return (unsigned char) __builtin_ia32_ktestcqi (__A, __B);
}
+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_mask8_u8 (__mmask8 __A, __mmask8 __B, unsigned char *__CF)
return (__mmask8) __builtin_ia32_kaddqi ((__mmask8) __A, (__mmask8) __B);
}
+extern __inline __mmask16
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_kadd_mask16 (__mmask16 __A, __mmask16 __B)
+{
+ return (__mmask16) __builtin_ia32_kaddhi ((__mmask16) __A, (__mmask16) __B);
+}
+
extern __inline unsigned int
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_cvtmask8_u32 (__mmask8 __A)
#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)
(__mmask16) __B);
}
-extern __inline __mmask16
-__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_kadd_mask16 (__mmask16 __A, __mmask16 __B)
-{
- return (__mmask16) __builtin_ia32_kaddhi ((__mmask16) __A, (__mmask16) __B);
-}
-
extern __inline unsigned int
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_cvtmask16_u32 (__mmask16 __A)
BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kiordi, "__builtin_ia32_kordi", IX86_BUILTIN_KOR64, UNKNOWN, (int) UDI_FTYPE_UDI_UDI)
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_AVX512DQ, CODE_FOR_ktesthi, "__builtin_ia32_ktestchi", IX86_BUILTIN_KTESTC16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
+BDESC (OPTION_MASK_ISA_AVX512DQ, 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_kmovd, "__builtin_ia32_kmovd", IX86_BUILTIN_KMOV32, UNKNOWN, (int) USI_FTYPE_USI)
BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kmovq, "__builtin_ia32_kmovq", IX86_BUILTIN_KMOV64, UNKNOWN, (int) UDI_FTYPE_UDI)
BDESC (OPTION_MASK_ISA_AVX512DQ, CODE_FOR_kaddqi, "__builtin_ia32_kaddqi", IX86_BUILTIN_KADD8, UNKNOWN, (int) UQI_FTYPE_UQI_UQI)
-BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kaddhi, "__builtin_ia32_kaddhi", IX86_BUILTIN_KADD16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
+BDESC (OPTION_MASK_ISA_AVX512DQ, CODE_FOR_kaddhi, "__builtin_ia32_kaddhi", IX86_BUILTIN_KADD16, UNKNOWN, (int) UHI_FTYPE_UHI_UHI)
BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kaddsi, "__builtin_ia32_kaddsi", IX86_BUILTIN_KADD32, UNKNOWN, (int) USI_FTYPE_USI_USI)
BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kadddi, "__builtin_ia32_kadddi", IX86_BUILTIN_KADD64, UNKNOWN, (int) UDI_FTYPE_UDI_UDI)
(define_mode_iterator SWI1248_AVX512BW
[QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
+;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
+(define_mode_iterator SWI1248_AVX512BWDQ2
+ [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
+ (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
+
(define_expand "kmov<mskmodesuffix>"
[(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
(match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
(const_string "<MODE>")))])
(define_insn "kadd<mode>"
- [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
- (plus:SWI1248_AVX512BWDQ
- (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
- (match_operand:SWI1248_AVX512BWDQ 2 "register_operand" "k")))
+ [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
+ (plus:SWI1248_AVX512BWDQ2
+ (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
+ (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
(unspec [(const_int 0)] UNSPEC_MASKOP)]
"TARGET_AVX512F"
"kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
(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")]
+ [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
+ (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
UNSPEC_KTEST))]
"TARGET_AVX512F"
"ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
+2017-01-26 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.target/i386/avx512f-kaddw-1.c: Renamed to ...
+ * gcc.target/i386/avx512dq-kaddw-1.c: ... this. New test. Replace
+ avx512f with avx512dq.
+ * gcc.target/i386/avx512f-ktestw-1.c: Renamed to ...
+ * gcc.target/i386/avx512dq-ktestw-1.c: ... this. New test. Replace
+ avx512f with avx512dq.
+ * gcc.target/i386/avx512f-ktestw-2.c: Renamed to ...
+ * gcc.target/i386/avx512dq-ktestw-2.c: ... this. New test. Replace
+ avx512f with avx512dq.
+
2017-01-26 Marek Polacek <polacek@redhat.com>
PR c/79199
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512dq -O2" } */
+/* { dg-final { scan-assembler-times "kaddw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+void
+avx512dq_test ()
+{
+ __mmask16 k = _kadd_mask16 (11, 12);
+ asm volatile ("" : "+k" (k));
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx512dq" } */
+/* { dg-final { scan-assembler-times "ktestw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+void
+avx512dq_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 -mavx512dq" } */
+/* { dg-require-effective-target avx512dq } */
+
+#include "avx512dq-check.h"
+
+void
+avx512dq_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 ();
+}
+++ /dev/null
-/* { dg-do compile } */
-/* { dg-options "-mavx512f -O2" } */
-/* { dg-final { scan-assembler-times "kaddw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */
-
-#include <immintrin.h>
-
-void
-avx512f_test ()
-{
- __mmask16 k = _kadd_mask16 (11, 12);
- asm volatile ("" : "+k" (k));
-}
+++ /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 ();
-}