From 437d32d54743ac3cde581a4696af825c0c68503a Mon Sep 17 00:00:00 2001 From: gnezdo Date: Fri, 21 Jan 2022 03:12:55 +0000 Subject: [PATCH] Unplug assembly implementations of trig functions on x86 platforms The same change was done by NetBSD some time back as: Disable x87 implementations of sin, cos, tan. The x87 hardware uses a bad approximation to pi for argument reduction, and consequently yields bad answers for inputs near pi or pi/2. OK mbuhl@, tested by mbuhl@ and phessler@ --- lib/libm/Makefile | 11 +++++------ regress/lib/libm/msun/Makefile | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 47cd94cac06..689f3816809 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.122 2021/04/27 00:31:34 drahn Exp $ +# $OpenBSD: Makefile,v 1.123 2022/01/21 03:12:55 gnezdo Exp $ # $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $ # # @(#)Makefile 5.1beta 93/09/24 @@ -22,11 +22,10 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \ e_sqrtl.S \ invtrig.c \ s_atan.S s_atanf.S s_ceil.S s_ceilf.S s_copysign.S s_copysignf.S \ - s_cos.S s_cosf.S s_floor.S s_floorf.S \ + s_floor.S s_floorf.S \ s_log1p.S s_log1pf.S s_logb.S s_logbf.S \ s_llrint.S s_llrintf.S s_lrint.S s_lrintf.S s_rint.S s_rintf.S\ - s_scalbnf.S s_significand.S s_significandf.S \ - s_sin.S s_sinf.S s_tan.S s_tanf.S + s_scalbnf.S s_significand.S s_significandf.S .elif (${MACHINE_ARCH} == "amd64") .PATH: ${.CURDIR}/arch/amd64 CPPFLAGS+=-I${.CURDIR}/arch/amd64 @@ -35,11 +34,11 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \ e_sqrtl.S \ invtrig.c \ s_atan.S s_atanf.S s_ceil.S s_ceilf.S s_copysign.S s_copysignf.S \ - s_cos.S s_cosf.S s_floor.S s_floorf.S \ + s_floor.S s_floorf.S \ s_log1p.S s_log1pf.S s_logb.S s_logbf.S \ s_llrint.S s_llrintf.S s_lrint.S s_lrintf.S \ s_rint.S s_rintf.S s_scalbnf.S s_significand.S \ - s_significandf.S s_sin.S s_sinf.S s_tan.S s_tanf.S + s_significandf.S .elif (${MACHINE_ARCH} == "hppa") .PATH: ${.CURDIR}/arch/hppa ARCH_SRCS = e_sqrt.c e_sqrtf.c e_remainder.c e_remainderf.c \ diff --git a/regress/lib/libm/msun/Makefile b/regress/lib/libm/msun/Makefile index 48ec4c3d95b..92e7e4618b2 100644 --- a/regress/lib/libm/msun/Makefile +++ b/regress/lib/libm/msun/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2022/01/14 19:53:42 mbuhl Exp $ +# $OpenBSD: Makefile,v 1.8 2022/01/21 03:12:56 gnezdo Exp $ # Copyright (c) 2021 Moritz Buhl # @@ -58,7 +58,6 @@ FAILING+= run-ctrig_test-1 FAILING+= run-exponential_test-1 FAILING+= run-invtrig_test-7 FAILING+= run-next_test-{1,2,4} -FAILING+= run-trig_test-3 . elif ${MACHINE} == arm64 FAILING+= run-cexp_test-{1,7} FAILING+= run-ctrig_test-{1,5} -- 2.20.1