From: Jakub Jelinek Date: Thu, 26 Jan 2017 12:24:58 +0000 (+0100) Subject: avx512fintrin.h (_ktest_mask16_u8, [...]): Move to ... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5f75f0b64a5692ebe823fffcf6d3a8c82c52d10;p=gcc.git avx512fintrin.h (_ktest_mask16_u8, [...]): Move to ... * 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, ktest): Use it instead of SWI1248_AVX512BWDQ. testsuite/ * 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. From-SVN: r244929 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb0e7056415..c0d588b630c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2017-01-26 Jakub Jelinek + + * 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, ktest): Use it instead of SWI1248_AVX512BWDQ. + 2017-01-26 Marek Polacek PR c/79199 diff --git a/gcc/config/i386/avx512dqintrin.h b/gcc/config/i386/avx512dqintrin.h index 670e41e0b94..88e8adb18c5 100644 --- a/gcc/config/i386/avx512dqintrin.h +++ b/gcc/config/i386/avx512dqintrin.h @@ -56,6 +56,28 @@ _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__)) +_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) @@ -85,6 +107,13 @@ _kadd_mask8 (__mmask8 __A, __mmask8 __B) 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) diff --git a/gcc/config/i386/avx512fintrin.h b/gcc/config/i386/avx512fintrin.h index 6c11453287a..68c3d6a105a 100644 --- a/gcc/config/i386/avx512fintrin.h +++ b/gcc/config/i386/avx512fintrin.h @@ -10006,28 +10006,6 @@ _mm512_maskz_expandloadu_epi32 (__mmask16 __U, void const *__P) #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) @@ -10052,13 +10030,6 @@ _kortestc_mask16_u8 (__mmask16 __A, __mmask16 __B) (__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) diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def index 137aa3e1066..a8fe0a510a4 100644 --- a/gcc/config/i386/i386-builtin.def +++ b/gcc/config/i386/i386-builtin.def @@ -1466,8 +1466,8 @@ BDESC (OPTION_MASK_ISA_AVX512BW, CODE_FOR_kiorsi, "__builtin_ia32_korsi", IX86_B 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) @@ -1495,7 +1495,7 @@ BDESC (OPTION_MASK_ISA_AVX512F, CODE_FOR_kmovw, "__builtin_ia32_kmovw", IX86_BUI 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) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 0d074f851a2..a19c8f2bc2e 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -1302,6 +1302,11 @@ (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" [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand") (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))] @@ -1398,10 +1403,10 @@ (const_string "")))]) (define_insn "kadd" - [(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\t{%2, %1, %0|%0, %1, %2}" @@ -1427,8 +1432,8 @@ (define_insn "ktest" [(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\t{%1, %0|%0, %1}" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6b5ecb417dd..4054dd0a11a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2017-01-26 Jakub Jelinek + + * 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 PR c/79199 diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-kaddw-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-kaddw-1.c new file mode 100644 index 00000000000..86d92b997a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-kaddw-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx512dq -O2" } */ +/* { dg-final { scan-assembler-times "kaddw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */ + +#include + +void +avx512dq_test () +{ + __mmask16 k = _kadd_mask16 (11, 12); + asm volatile ("" : "+k" (k)); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-ktestw-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-ktestw-1.c new file mode 100644 index 00000000000..5394604814f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-ktestw-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -mavx512dq" } */ +/* { dg-final { scan-assembler-times "ktestw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */ + +#include + +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); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-ktestw-2.c b/gcc/testsuite/gcc.target/i386/avx512dq-ktestw-2.c new file mode 100644 index 00000000000..fcc0cf47eb0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-ktestw-2.c @@ -0,0 +1,20 @@ +/* { 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 (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-kaddw-1.c b/gcc/testsuite/gcc.target/i386/avx512f-kaddw-1.c deleted file mode 100644 index 957a39540fb..00000000000 --- a/gcc/testsuite/gcc.target/i386/avx512f-kaddw-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-mavx512f -O2" } */ -/* { dg-final { scan-assembler-times "kaddw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */ - -#include - -void -avx512f_test () -{ - __mmask16 k = _kadd_mask16 (11, 12); - asm volatile ("" : "+k" (k)); -} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-ktestw-1.c b/gcc/testsuite/gcc.target/i386/avx512f-ktestw-1.c deleted file mode 100644 index f6151d1671d..00000000000 --- a/gcc/testsuite/gcc.target/i386/avx512f-ktestw-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O0 -mavx512f" } */ -/* { dg-final { scan-assembler-times "ktestw\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 2 } } */ - -#include - -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); -} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-ktestw-2.c b/gcc/testsuite/gcc.target/i386/avx512f-ktestw-2.c deleted file mode 100644 index 6602c7a1574..00000000000 --- a/gcc/testsuite/gcc.target/i386/avx512f-ktestw-2.c +++ /dev/null @@ -1,20 +0,0 @@ -/* { 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 (); -}