25 lines
603 B
ArmAsm
25 lines
603 B
ArmAsm
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
|||
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
|
||
|
|
#include "textflag.h"
|
||
|
|
|
||
|
|
// func fma(a, b, c float64) float64
|
||
|
|
// Computes a*b + c using fused multiply-add.
|
||
|
|
TEXT ·fma(SB), NOSPLIT, $0-32
|
||
|
|
FLD a+0(FP), FA0
|
||
|
|
FLD b+8(FP), FA1
|
||
|
|
FLD c+16(FP), FA2
|
||
|
|
FMADDD FA0, FA1, FA2, FA3
|
||
|
|
FSD FA3, ret+24(FP)
|
||
|
|
RET
|
||
|
|
|
||
|
|
// func fms(a, b, c float64) float64
|
||
|
|
// Computes a*b - c using fused multiply-subtract.
|
||
|
|
TEXT ·fms(SB), NOSPLIT, $0-32
|
||
|
|
FLD a+0(FP), FA0
|
||
|
|
FLD b+8(FP), FA1
|
||
|
|
FLD c+16(FP), FA2
|
||
|
|
FMSUBD FA0, FA1, FA2, FA3
|
||
|
|
FSD FA3, ret+24(FP)
|
||
|
|
RET
|