[all-commits] [llvm/llvm-project] d3c16b: [x86] add tests for setcc of rotate; NFC

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Mar 3 06:26:09 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d3c16be9845410666bea479f8989414e40e44bfa
      https://github.com/llvm/llvm-project/commit/d3c16be9845410666bea479f8989414e40e44bfa
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-03-03 (Thu, 03 Mar 2022)

  Changed paths:
    M llvm/test/CodeGen/X86/setcc-fsh.ll

  Log Message:
  -----------
  [x86] add tests for setcc of rotate; NFC


  Commit: e9302bf7efc70a26cfa620ffaa614dc70cdb0259
      https://github.com/llvm/llvm-project/commit/e9302bf7efc70a26cfa620ffaa614dc70cdb0259
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-03-03 (Thu, 03 Mar 2022)

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

  Log Message:
  -----------
  [SDAG] try harder to remove a rotate from X == 0

https://alive2.llvm.org/ce/z/mJP7XP

This can be viewed as expanding the compare into and/or-of-compares:
https://alive2.llvm.org/ce/z/bkZYWE
followed by reduction of each compare.

This could be extended in several ways:
1. There's a (X & Y) == -1 sibling.
2. We can recurse through more than 1 'or'.
3. The fold could be generalized beyond rotates - any operation that
   only changes the order of bits (bswap, bitreverse).

This is a transform noted in D111530.


Compare: https://github.com/llvm/llvm-project/compare/1b6663a10458...e9302bf7efc7


More information about the All-commits mailing list