Wed Jul 21 12:05:02 2021 UTC ()
libm: build fma(3), fmaf(3), fmal(3) on alpha

Alpha has no hardware-assisted fused multiply-add, so the fallback
C implementation must be used. A basic smoke test shows the
implementation works for
"x * x - 1.0f" vs "fmaf(x, x, -1.0f)" with "volatile float x = 1.0008f;"


(tnn)
diff -r1.213 -r1.214 src/lib/libm/Makefile

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

--- src/lib/libm/Makefile 2021/04/25 23:43:20 1.213
+++ src/lib/libm/Makefile 2021/07/21 12:05:02 1.214
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.213 2021/04/25 23:43:20 christos Exp $ 1# $NetBSD: Makefile,v 1.214 2021/07/21 12:05:02 tnn 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#
@@ -61,26 +61,27 @@ LINTFLAGS += -g @@ -61,26 +61,27 @@ LINTFLAGS += -g
61ARCH_SRCS = e_sqrt.S e_sqrtf.S s_fabsf.S 61ARCH_SRCS = e_sqrt.S e_sqrtf.S s_fabsf.S
62ARCH_SRCS+= s_fma.S s_fmaf.S s_fmax.S s_fmaxf.S s_fmin.S s_fminf.S 62ARCH_SRCS+= s_fma.S s_fmaf.S s_fmax.S s_fmaxf.S s_fmin.S s_fminf.S
63.if ${MKSOFTFLOAT} == "no" 63.if ${MKSOFTFLOAT} == "no"
64COMMON_SRCS+= fenv.c 64COMMON_SRCS+= fenv.c
65.endif 65.endif
66COMMON_SRCS+= s_nexttoward.c s_rintl.c 66COMMON_SRCS+= s_nexttoward.c s_rintl.c
67COMMON_SRCS+= e_sqrtl.c 67COMMON_SRCS+= e_sqrtl.c
68COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c 68COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
69 69
70.elif (${LIBC_MACHINE_ARCH} == "alpha") 70.elif (${LIBC_MACHINE_ARCH} == "alpha")
71.PATH: ${.CURDIR}/arch/alpha 71.PATH: ${.CURDIR}/arch/alpha
72ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S 72ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S
73COMMON_SRCS+= fenv.c 73COMMON_SRCS+= fenv.c
 74COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
74COPTS+= -mfloat-ieee -mieee-with-inexact -mfp-trap-mode=sui -mtrap-precision=i 75COPTS+= -mfloat-ieee -mieee-with-inexact -mfp-trap-mode=sui -mtrap-precision=i
75 76
76.elif (${LIBC_MACHINE_CPU} == "arm") 77.elif (${LIBC_MACHINE_CPU} == "arm")
77.PATH.c: ${.CURDIR}/arch/arm 78.PATH.c: ${.CURDIR}/arch/arm
78.if ${MKSOFTFLOAT} == "no" 79.if ${MKSOFTFLOAT} == "no"
79COMMON_SRCS+= fenv.c 80COMMON_SRCS+= fenv.c
80.endif 81.endif
81COMMON_SRCS+= s_rintl.c 82COMMON_SRCS+= s_rintl.c
82.for f in fenv.c lrint.S lrintf.S s_fabsf.S s_fma.S s_fmaf.S 83.for f in fenv.c lrint.S lrintf.S s_fabsf.S s_fma.S s_fmaf.S
83COPTS.$f += -mfpu=vfp 84COPTS.$f += -mfpu=vfp
84.endfor 85.endfor
85COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c 86COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
86.if (${MKSOFTFLOAT} == "no") 87.if (${MKSOFTFLOAT} == "no")