[all-commits] [llvm/llvm-project] 03a470: [RISCV] Fix the neutral element in vector 'fadd' r...

Fraser Cormack via All-commits all-commits at lists.llvm.org
Wed Jul 14 02:27:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 03a4702c884a0498db902aff34ebb19c48b4696b
      https://github.com/llvm/llvm-project/commit/03a4702c884a0498db902aff34ebb19c48b4696b
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-07-14 (Wed, 14 Jul 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-fp.ll
    M llvm/test/CodeGen/RISCV/rvv/vreductions-fp-sdnode.ll

  Log Message:
  -----------
  [RISCV] Fix the neutral element in vector 'fadd' reductions

Using positive zero as the neutral element in 'fadd' reductions, while
it generates better code, is incorrect. The correct neutral element is
negative zero: 0.0 + -0.0 = 0.0, whereas -0.0 + -0.0 = -0.0.

There are perhaps more optimal lowerings of negative zero avoiding
constant-pool loads which could be left as future work.

Reviewed By: craig.topper

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




More information about the All-commits mailing list