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

Filipe Cabecinhas filcab+llvm.phabricator at gmail.com
Tue May 13 20:09:26 PDT 2014


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3752.9372.patch
Type: text/x-patch
Size: 17899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140514/2819fc16/attachment.bin>


More information about the llvm-commits mailing list