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. Jakub