[all-commits] [llvm/llvm-project] 5fcdf7: [RISCV] Optimize (brcond (seteq (and X, (1 << C)-1...

Liao Chunyu via All-commits all-commits at lists.llvm.org
Fri Jan 13 05:02:03 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fcdf7623f413aa5985252eb93ecd72efe6b485a
      https://github.com/llvm/llvm-project/commit/5fcdf7623f413aa5985252eb93ecd72efe6b485a
  Author: LiaoChunyu <chunyu at iscas.ac.cn>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/bittest.ll
    M llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
    M llvm/test/CodeGen/RISCV/pr56457.ll

  Log Message:
  -----------
  [RISCV] Optimize (brcond (seteq (and X, (1 << C)-1), 0))

Inspired by gcc's assembly: https://godbolt.org/z/54hbzsGYn, while referring to D130203

Replace AND+IMM{32,64} with a slli.

But gcc does not handle 0xffff and 0xffffffff, which also seem to be optimizable.

The testcases copies all the bits in D130203 and adds 16, 32, and 64 bits.

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




More information about the All-commits mailing list