]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix FMA negative commutativity of riscv64
authorMeng Zhuo <mzh@golangcn.org>
Tue, 27 Jun 2023 15:22:04 +0000 (23:22 +0800)
committerKeith Randall <khr@golang.org>
Wed, 5 Jul 2023 22:05:44 +0000 (22:05 +0000)
commit3fce1115359c4ab7d67fbf4efef1341e52b354b7
tree6952092aebcb61ea958270683a299e9ebc48d73d
parentc8dad424bf01df69af729845acc151a66b87d594
cmd/compile: fix FMA negative commutativity of riscv64

According to RISCV manual 11.6:

FMADD x,y,z computes x*y+z and
FNMADD x,y,z => -x*y-z
FMSUB x,y,z => x*y-z
FNMSUB x,y,z => -x*y+z respectively

However our implement of SSA convert FMADD -x,y,z to FNMADD x,y,z which
is wrong and should be convert to FNMSUB according to manual.

Change-Id: Ib297bc83824e121fd7dda171ed56ea9694a4e575
Reviewed-on: https://go-review.googlesource.com/c/go/+/506575
Run-TryBot: M Zhuo <mzh@golangcn.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Michael Munday <mike.munday@lowrisc.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/ssa/_gen/RISCV64.rules
src/cmd/compile/internal/ssa/rewriteRISCV64.go
test/codegen/math.go