[all-commits] [llvm/llvm-project] af161f: [RISCV] Fold (select setcc, setcc, setcc) into and...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Fri May 12 00:08:19 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: af161ffc7fdd8a258c571fd50a4642011cf184de
      https://github.com/llvm/llvm-project/commit/af161ffc7fdd8a258c571fd50a4642011cf184de
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2023-05-12 (Fri, 12 May 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/forced-atomics.ll
    M llvm/test/CodeGen/RISCV/fpclamptosat.ll
    M llvm/test/CodeGen/RISCV/iabs.ll
    M llvm/test/CodeGen/RISCV/lack-of-signed-truncation-check.ll
    M llvm/test/CodeGen/RISCV/xaluo.ll

  Log Message:
  -----------
  [RISCV] Fold (select setcc, setcc, setcc) into and/or instructions

This patch folds `(select setcc, setcc, setcc)` into and/or instructions when truev/falsev is equal to or the inverse of condv.

(select x, x, y) -> x | y https://alive2.llvm.org/ce/z/36Ud3Z
(select !x, x, y) -> x & y https://alive2.llvm.org/ce/z/mYYoGF
(select x, y, x) -> x & y https://alive2.llvm.org/ce/z/MAZ--X
(select !x, y, x) -> x | y https://alive2.llvm.org/ce/z/ct7By5

It is the follow-up improvement of D150177, which optimizes the code of signed truncation check patterns without Zbb.

Reviewed By: craig.topper

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




More information about the All-commits mailing list