[PATCH] D105902: [RISCV] Fix the neutral element in vector 'fadd' reductions

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 09:22:38 PDT 2021


frasercrmck created this revision.
frasercrmck added reviewers: craig.topper, rogfer01, HsiangKai, evandro, arcbbb.
Herald added subscribers: vkmr, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105902

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105902.358298.patch
Type: text/x-patch
Size: 20419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210713/68b37e62/attachment.bin>


More information about the llvm-commits mailing list