On Wed, Jan 18, 2017 at 1:45 PM, Andrew Senkevich <andrew.n.senkev...@gmail.com> wrote: > 2017-01-17 16:51 GMT+03:00 Jakub Jelinek <ja...@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? > > 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/avx-1.c: Test new intrinsics. > * gcc.target/i386/sse-13.c: Ditto. > * gcc.target/i386/sse-23.c: Ditto.
OK. Thanks, Uros.