[PATCH] D122919: [SDAG] try to reduce compare of funnel shift equal 0

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 10:37:50 PDT 2022


spatel created this revision.
spatel added reviewers: fzhinkin, lebedev.ri, RKSimon.
Herald added subscribers: pengfei, hiraditya, mcrosier.
Herald added a project: All.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

fshl (or X, Y), X, C ==/!= 0 --> or (shl Y, C), X ==/!= 0
fshl X, (or X, Y), C ==/!= 0 --> or (srl Y, BW-C), X ==/!= 0

This is similar to an existing setcc-of-rotate fold, but the matching requires more checks for the more general funnel op:
https://alive2.llvm.org/ce/z/Ab2jDd

We are effectively decomposing the funnel shift into logical shifts, reassociating, and removing a shift.

This should get us the final improvements for x86-64 that were originally shown in D111530 <https://reviews.llvm.org/D111530> ( https://github.com/llvm/llvm-project/issues/49541 ); x86-32 still shows some SHLD/SHRD, so the pattern is not matching there yet.


https://reviews.llvm.org/D122919

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/AArch64/setcc-fsh.ll
  llvm/test/CodeGen/X86/icmp-shift-opt.ll
  llvm/test/CodeGen/X86/setcc-fsh.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122919.419795.patch
Type: text/x-patch
Size: 17128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220401/b1142186/attachment.bin>


More information about the llvm-commits mailing list