diff options
| author | Meng Zhuo <mzh@golangcn.org> | 2023-06-27 23:22:04 +0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2023-07-05 22:05:44 +0000 |
| commit | 3fce1115359c4ab7d67fbf4efef1341e52b354b7 (patch) | |
| tree | 6952092aebcb61ea958270683a299e9ebc48d73d /test/codegen | |
| parent | c8dad424bf01df69af729845acc151a66b87d594 (diff) | |
| download | go-3fce1115359c4ab7d67fbf4efef1341e52b354b7.tar.xz | |
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>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/math.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/codegen/math.go b/test/codegen/math.go index 6a7d304afd..331ebbe609 100644 --- a/test/codegen/math.go +++ b/test/codegen/math.go @@ -143,13 +143,13 @@ func fms(x, y, z float64) float64 { return math.FMA(x, y, -z) } -func fnma(x, y, z float64) float64 { - // riscv64:"FNMADDD" +func fnms(x, y, z float64) float64 { + // riscv64:"FNMSUBD",-"FNMADDD" return math.FMA(-x, y, z) } -func fnms(x, y, z float64) float64 { - // riscv64:"FNMSUBD" +func fnma(x, y, z float64) float64 { + // riscv64:"FNMADDD",-"FNMSUBD" return math.FMA(x, -y, -z) } |
