[PATCH] D136432: [AMDGPU] Combine BFI instructions.

Thomas Symalla via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 04:12:57 PST 2022


tsymalla updated this revision to Diff 474222.
tsymalla added a comment.

This change handles most of the tree structures, but not 
all of them, because this would add way more complexity.

This uses two separate stacks, one as "working list"  
to traverse the ORs, and one as stack to collect all 
possible ORs. This is done so the top-level OR is not   
required to be processed separately.

This also adds divergence checks as they appear in the 
standard BFI pattern matching, because we don't have a 
scalar BFI instruction and don't want to utilize the VALU 
for several scalar instructions (such patterns currently 
appear in unrelated tests).

This also handles the mask and base appearing at            
arbitrary positions of the AND instructions.

It also utilizes the SDLoc of the original OR instructions 
for inserting the new DAG nodes, so the ordering might be 
a bit better at the end.

The boolean return values of `CreateBFIOpFromAnd` were    
replaced by a binary-value enum class, which 
contains more descriptive entries. In some cases, we just 
want to skip the current entry instead of returning false.

This also adds some more tests for changed operand order or 
matching a unbalanced tree structure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136432/new/

https://reviews.llvm.org/D136432

Files:
  llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h
  llvm/test/CodeGen/AMDGPU/bfi_nested.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136432.474222.patch
Type: text/x-patch
Size: 9262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221109/73e96218/attachment.bin>


More information about the llvm-commits mailing list