This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add AVX512 k-mask intrinsics


2017-01-19 13:39 GMT+03:00 Kirill Yukhin <kirill.yukhin@gmail.com>:
> Hi Andrew,
> On 18 Jan 15:45, Andrew Senkevich wrote:
>> 2017-01-17 16:51 GMT+03:00 Jakub Jelinek <jakub@redhat.com>:
>> > On Tue, Jan 17, 2017 at 04:03:08PM +0300, Andrew Senkevich wrote:
>> >> > I've played a bit w/ SDE. And looks like operands are not early clobber:
>> >> > TID0: INS 0x00000000004003ee             AVX512VEX kmovd k0, eax
>> >> > TID0:   k0 := 00000000_ffffffff
>> >> > ...
>> >> > TID0: INS 0x00000000004003f4             AVX512VEX kshiftlw k0, k0, 0x3
>> >> > TID0:   k0 := 00000000_0000fff8
>> >> >
>> >> > You can see that same dest and source works just fine.
>> >>
>> >> Hmm, I looked only on what ICC generates, and it was not correct way.
>> >
>> > I've just tried
>> > int
>> > main ()
>> > {
>> >   unsigned int a = 0x5555;
>> >   asm volatile ("kmovw %1, %%k6; kshiftlw $1, %%k6, %%k6; kmovw %%k6, %0" : "=r" (a) : "r" (a) : "k6");
>> >   __builtin_printf ("%x\n", a);
>> >   return 0;
>> > }
>> > on KNL and got 0xaaaa.
>> > Are you going to report to the SDM authors so that they fix it up?
>> > E.g. using TEMP <- SRC1[0:...] before DEST[...] <- 0 and using TEMP
>> > instead of SRC1[0:...] would fix it, or filling up TEMP first and only
>> > at the end assigning DEST <- TEMP etc. would do.
>>
>> Yes, we will work on it.
>>
>> Attached patch refactored in part of builtints declarations and tests, is it Ok?
>
> Could you please add runtime tests for new intrinsics as well?

Attached with runtime tests.

gcc/
    * config/i386/avx512bwintrin.h: Add k-mask registers shift intrinsics.
    * config/i386/avx512dqintrin.h: Ditto.
    * config/i386/avx512fintrin.h: Ditto.
    * config/i386/i386-builtin-types.def: Add new types.
    * gcc/config/i386/i386.c: Handle new types.
    * config/i386/i386-builtin.def (__builtin_ia32_kshiftliqi,
    __builtin_ia32_kshiftlihi, __builtin_ia32_kshiftlisi,
    __builtin_ia32_kshiftlidi, __builtin_ia32_kshiftriqi,
    __builtin_ia32_kshiftrihi, __builtin_ia32_kshiftrisi,
    __builtin_ia32_kshiftridi): New.
    * config/i386/sse.md (k<code><mode>): Rename *k<code><mode>.

gcc/testsuite/
    * gcc.target/i386/avx512bw-kshiftld-1.c: New test.
    * gcc.target/i386/avx512bw-kshiftlq-1.c: Ditto.
    * gcc.target/i386/avx512dq-kshiftlb-1.c: Ditto.
    * gcc.target/i386/avx512f-kshiftlw-1.c: Ditto.
    * gcc.target/i386/avx512bw-kshiftrd-1.c: Ditto.
    * gcc.target/i386/avx512bw-kshiftrq-1.c: Ditto.
    * gcc.target/i386/avx512dq-kshiftrb-1.c: Ditto.
    * gcc.target/i386/avx512f-kshiftrw-1.c: Ditto.
    * gcc.target/i386/avx512bw-kshiftld-2.c: Ditto.
    * gcc.target/i386/avx512bw-kshiftlq-2.c: Ditto.
    * gcc.target/i386/avx512bw-kshiftrd-2.c: Ditto.
    * gcc.target/i386/avx512bw-kshiftrq-2.c: Ditto.
    * gcc.target/i386/avx512dq-kshiftlb-2.c: Ditto.
    * gcc.target/i386/avx512dq-kshiftrb-2.c: Ditto.
    * gcc.target/i386/avx512f-kshiftlw-2.c: Ditto.
    * gcc.target/i386/avx512f-kshiftrw-2.c: Ditto.
    * gcc.target/i386/avx-1.c: Test new intrinsics.
    * gcc.target/i386/sse-13.c: Ditto.
    * gcc.target/i386/sse-23.c: Ditto.


--
WBR,
Andrew

Attachment: avx512-kmask-intrin-part4.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]