[PATCH] D16755: AVX512: fix mask handling for gather/scatter/prefetch

Igor Breger via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 31 23:16:21 PST 2016

igorb added inline comments.

Comment at: lib/Target/X86/X86ISelLowering.cpp:16486
@@ -16485,1 +16485,3 @@
+  if (isAllOnesConstant(Mask))
+    return DAG.getTargetConstant(1, dl, MaskVT);
delena wrote:
> Why do you need all-ones and all-zeroes. If the mask is all-zero you don't need any scatter. What happens if the mask is a constant - a mix ones and zeroes?
in general convert const to mask using gpr -  for example
      movw $220, %ax
      kmovw %eax, %k1
in all zero use kxorw 
      kxorw %k0, %k0, %k1
in all-ones
      kxnorw %k0, %k0, %k1

i agree that in case all-zero mask, instruction  has no affect and can be removed at all, but this case not handled for any intrinsic.



More information about the llvm-commits mailing list