[all-commits] [llvm/llvm-project] 2ed159: [SDAG] try to reduce compare of funnel shift equal 0

Sanjay Patel via All-commits all-commits at lists.llvm.org
Mon Apr 11 04:50:40 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ed15984b49a1af87be37ec8bd6ee3ab7f724767
      https://github.com/llvm/llvm-project/commit/2ed15984b49a1af87be37ec8bd6ee3ab7f724767
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-04-11 (Mon, 11 Apr 2022)

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

  Log Message:
  -----------
  [SDAG] try to reduce compare of funnel shift equal 0

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://github.com/llvm/llvm-project/issues/49541 );
x86-32 still shows some SHLD/SHRD, so the pattern is not
matching there yet.

Differential Revision: https://reviews.llvm.org/D122919




More information about the All-commits mailing list