[PATCH] D17041: [X86] Don't assume that a shuffle operand is #0: it isn't for VPERMV.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 29 16:52:36 PST 2016


ab added a comment.

In http://reviews.llvm.org/D17041#363755, @delena wrote:

> > Ping of sorts: Elena, all, how do you think we should fix this: swap the VPERMV operands, or change all of our code to stop assuming the mask is the last operand (this patch)? I don't do much AVX512, so I'm not comfortable making that decision.
>
>
> In my opinion, the mask op should not be always the last. I don't think that you need to swap  VPERMV operands. As far as AVX-512 - the form is the same: 
>  vpermd %vec_op, %mask_op, %vec_res.
>
> I'll say you more - in AVX-512 we have two forms of 3-src shuffles:
>  VPERMT2D zmm1 {k1}{z}, zmm2, zmm3/m512/m32bcst Permute double-words from two tables in zmm3/m512/m32bcst and zmm1 using indices in zmm2 and store the result in zmm1 using writemask k1
>
> VPERMI2D zmm1 {k1}{z}, zmm2, zmm3/m512/m32bcst Permute double-words from two tables in zmm3/m512/m32bcst and zmm2 using indices in zmm1 and store the result in zmm1 using writemask k1.
>
> So, it's ok that the mask is not last in SDNode.


All else being equal, I'd actually really prefer for the mask to always be last, because it helps preserve sanity in the backend :(

So, you say it's OK for VPERMVBut I think I'm really asking the opposite: is it OK if we make the mask always be the last operand?

Otherwise, I rebased and cleaned up the patch, so reviews are appreciated!


http://reviews.llvm.org/D17041





More information about the llvm-commits mailing list