Thu Jun 23 16:42:50 2022 UTC ()
Use "fmadd" to implement fma(3) on ppc.


(martin)
diff -r1.215 -r1.216 src/lib/libm/Makefile
diff -r0 -r1.1 src/lib/libm/arch/powerpc/s_fma.S
diff -r0 -r1.1 src/lib/libm/arch/powerpc/s_fmaf.S

cvs diff -r1.215 -r1.216 src/lib/libm/Makefile (expand / switch to unified diff)

--- src/lib/libm/Makefile 2022/06/23 07:50:14 1.215
+++ src/lib/libm/Makefile 2022/06/23 16:42:50 1.216
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.215 2022/06/23 07:50:14 he Exp $ 1# $NetBSD: Makefile,v 1.216 2022/06/23 16:42:50 martin Exp $
2# 2#
3# @(#)Makefile 5.1beta 93/09/24 3# @(#)Makefile 5.1beta 93/09/24
4# 4#
5# ==================================================== 5# ====================================================
6# Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 6# Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7# 7#
8# Developed at SunPro, a Sun Microsystems, Inc. business. 8# Developed at SunPro, a Sun Microsystems, Inc. business.
9# Permission to use, copy, modify, and distribute this 9# Permission to use, copy, modify, and distribute this
10# software is freely granted, provided that this notice 10# software is freely granted, provided that this notice
11# is preserved. 11# is preserved.
12# ==================================================== 12# ====================================================
13# 13#
14# 14#
@@ -185,26 +185,27 @@ ARCH_SRCS = e_sqrt.S e_sqrtf.S @@ -185,26 +185,27 @@ ARCH_SRCS = e_sqrt.S e_sqrtf.S
185ARCH_SRCS += s_copysign.S s_copysignf.S 185ARCH_SRCS += s_copysign.S s_copysignf.S
186ARCH_SRCS += s_fabs.S s_fabsf.S 186ARCH_SRCS += s_fabs.S s_fabsf.S
187ARCH_SRCS += s_fma.S s_fmaf.S 187ARCH_SRCS += s_fma.S s_fmaf.S
188ARCH_SRCS += s_fmax.S s_fmaxf.S 188ARCH_SRCS += s_fmax.S s_fmaxf.S
189ARCH_SRCS += s_fmin.S s_fminf.S 189ARCH_SRCS += s_fmin.S s_fminf.S
190.endif 190.endif
191 191
192.elif (${LIBC_MACHINE_ARCH} == "powerpc") 192.elif (${LIBC_MACHINE_ARCH} == "powerpc")
193.PATH: ${.CURDIR}/arch/powerpc 193.PATH: ${.CURDIR}/arch/powerpc
194.if ${MKSOFTFLOAT} == "no" 194.if ${MKSOFTFLOAT} == "no"
195COMMON_SRCS += fenv.c 195COMMON_SRCS += fenv.c
196.endif 196.endif
197COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c 197COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 198ARCH_SRCS += s_fma.S s_fmaf.S
198 199
199.elif (${LIBC_MACHINE_CPU} == "mips") 200.elif (${LIBC_MACHINE_CPU} == "mips")
200.PATH: ${.CURDIR}/arch/mips 201.PATH: ${.CURDIR}/arch/mips
201.if ${MKSOFTFLOAT} == "no" 202.if ${MKSOFTFLOAT} == "no"
202COMMON_SRCS += fenv.c 203COMMON_SRCS += fenv.c
203.endif 204.endif
204COMMON_SRCS+= s_rintl.c 205COMMON_SRCS+= s_rintl.c
205.if ${MACHINE_MIPS64} && (!defined(CPUFLAGS) || empty(CPUFLAGS:M-mabi=32)) 206.if ${MACHINE_MIPS64} && (!defined(CPUFLAGS) || empty(CPUFLAGS:M-mabi=32))
206COMMON_SRCS+= s_nexttoward.c 207COMMON_SRCS+= s_nexttoward.c
207.endif 208.endif
208 209
209.elif (${LIBC_MACHINE_CPU} == "sh3") 210.elif (${LIBC_MACHINE_CPU} == "sh3")
210.PATH: ${.CURDIR}/arch/sh3 211.PATH: ${.CURDIR}/arch/sh3

File Added: src/lib/libm/arch/powerpc/s_fma.S
/* $NetBSD: s_fma.S,v 1.1 2022/06/23 16:42:50 martin Exp $ */

/* The contents of this file are in the public domain. */

#include <machine/asm.h>

#ifdef WEAK_ALIAS
WEAK_ALIAS(fmal, fma)
#endif

ENTRY(fma)
	fmadd	%f1, %f1, %f2, %f3
	blr
END(fma)

File Added: src/lib/libm/arch/powerpc/s_fmaf.S
/* $NetBSD: s_fmaf.S,v 1.1 2022/06/23 16:42:50 martin Exp $ */

/* The contents of this file are in the public domain. */

#include <machine/asm.h>

ENTRY(fmaf)
	fmadds	%f1, %f1, %f2, %f3
	blr
END(fmaf)