[PATCH] D114499: [GlobalISel] Fold or of shifts to funnel shifts.

Abinav Puthan Purayil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 23 21:04:07 PST 2021


abinavpp created this revision.
abinavpp added reviewers: aemerson, arsenm, foad, paquette.
Herald added subscribers: kerbowa, hiraditya, rovka, nhaehnle, jvesely.
abinavpp requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

This change folds a basic funnel shift idiom:

- (or (shl x, amt), (lshr y, sub(bw, amt)) -> fshl(x, y)
- (or (shl x, sub(bw, amt), (lshr y, amt)) -> fshr(x, y)

This also helps in folding to rotate shifts if the operands are equal
since we already have a funnel shift to rotate combine.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114499

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fsh.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/combine-rot.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114499.389385.patch
Type: text/x-patch
Size: 13125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211124/2fd21e92/attachment.bin>


More information about the llvm-commits mailing list