[PATCH] [X86 DAG] Lower vselects with a constant condition as blend+imm if possible

Nadav Rotem nrotem at apple.com
Wed May 14 13:22:42 PDT 2014

Overall this change makes sense. I did not review the patch carefully but I noticed that Andrea did. When you commit please split this patch to the different optimizations: shuffle blends, BLENDI, etc. 

On May 13, 2014, at 8:09 PM, Filipe Cabecinhas <filcab+llvm.phabricator at gmail.com> wrote:

> Hi grosbach, delena, nadav,
> I set the operation actions for VSELECT of appropriate vector types to be 
> Custom, and am taking care that the ones that were Legal are still treated 
> as that after the Custom step. Same goes for the ones previously marked as 
> Expand. 
> LowerVSELECT will, if possible, generate a X86ISD::BLENDI DAG node if the 
> condition is constant and we can emit that instruction, given the 
> subtarget. 
> This is not enough for all cases. If we're doing a vselect on vectors that 
> are not legal on this target they will be split. The best option I could 
> find, and which implies less code (and bugs) was to add a case to 
> PerformSELECTCombine, in order to match this operand split (we add some 
> size extensions when we legalize the types). 
> I also updated all the tests that failed because they were expecting 
> variable byte blends (blendvb) or similar and they had a vector of 
> constant conditions.
> http://reviews.llvm.org/D3752
> Files:
>  lib/Target/X86/X86ISelLowering.cpp
>  lib/Target/X86/X86ISelLowering.h
>  test/CodeGen/X86/avx-blend.ll
>  test/CodeGen/X86/avx2.ll
>  test/CodeGen/X86/blend-msb.ll
>  test/CodeGen/X86/sse41-blend.ll
>  test/CodeGen/X86/sse41.ll
> <D3752.9372.patch>

More information about the llvm-commits mailing list