[all-commits] [llvm/llvm-project] b894a9: [RISCV] Optimize select_cc after fp compare expansion

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Jan 14 13:48:50 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b894a9fb237345db64d14ce3881d3195e124df0d
      https://github.com/llvm/llvm-project/commit/b894a9fb237345db64d14ce3881d3195e124df0d
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.h
    M llvm/test/CodeGen/RISCV/double-select-fcmp.ll
    M llvm/test/CodeGen/RISCV/float-select-fcmp.ll
    M llvm/test/CodeGen/RISCV/half-select-fcmp.ll

  Log Message:
  -----------
  [RISCV] Optimize select_cc after fp compare expansion

Some FP compares expand to a sequence ending with (xor X, 1) to invert the result. If
the consumer is a select_cc we can likely get rid of this xor by fixing
up the select_cc condition.

This patch combines (select_cc (xor X, 1), 0, setne, trueV, falseV) -
(select_cc X, 0, seteq, trueV, falseV) if we can prove X is 0/1.

Reviewed By: lenary

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




More information about the All-commits mailing list