[all-commits] [llvm/llvm-project] 72ecf2: [RISCV] Optimize fixed vector ABS. Fix crash on sc...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Mar 9 08:58:37 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72ecf2f43ffb5cbc18a3f0572006bb4f891bf3dc
      https://github.com/llvm/llvm-project/commit/72ecf2f43ffb5cbc18a3f0572006bb4f891bf3dc
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-03-09 (Tue, 09 Mar 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.h
    A llvm/test/CodeGen/RISCV/rvv/abs-sdnode.ll
    A llvm/test/CodeGen/RISCV/rvv/fixed-vectors-abs.ll

  Log Message:
  -----------
  [RISCV] Optimize fixed vector ABS. Fix crash on scalable vector ABS for SEW=64 with RV32.

The default fixed vector expansion uses sra+xor+add since it can't
see that smax is legal due to our custom handling. So we select
smax(X, sub(0, X)) manually.

Scalable vectors are able to use the smax expansion automatically
for most cases. It crashes in one case because getConstant can't build a
SPLAT_VECTOR for nxvXi64 when i64 scalars aren't legal. So
we manually emit a SPLAT_VECTOR_I64 for that case.

Reviewed By: frasercrmck

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




More information about the All-commits mailing list