From nobody Fri Jun 26 16:17:22 2026 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gn16w60TXz6jkLb for ; Fri, 26 Jun 2026 16:18:00 +0000 (UTC) (envelope-from bT.dkqaow9mbhqog37=ejb62d0yp3w7=bvfbiww81o2lsn@em790814.fubar.geek.nz) Received: from e2i94.smtp2go.com (e2i94.smtp2go.com [103.2.140.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4gn16v3p69z449Y for ; Fri, 26 Jun 2026 16:17:58 +0000 (UTC) (envelope-from bT.dkqaow9mbhqog37=ejb62d0yp3w7=bvfbiww81o2lsn@em790814.fubar.geek.nz) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=mgy720.a1-4.dyn; x=1782491578; h=Feedback-ID: X-Smtpcorp-Track:To:Date:Subject:Message-Id:From:Reply-To:Sender: List-Unsubscribe:List-Unsubscribe-Post; bh=ZQJK4tzQbTTh44AEWLMWSfxnlMumtc+WW4PSZBVYpXU=; b=by3lakVFlaDR5f4/QGkh3bBWFw nC6bQSo9Woqgwc0T0O7Ph/Fjln+vkKuDKp1YkjmOZV3Dm+W+KG9GFVFwE7o3ZagmE+NUTNldF+8d2 eelnpNG9y4iAXT73jZPCS0Wg4KkdXDeTp7RuqlxSzEnMsh5N3m1mLMt9xCpeFxEcOzTHSsNvu/Dnh G0T5h4owdrTbvFcOyU5xvmuWBpGS3xkKoXZh09ZcepXMfI/2wJsVvHwlsQFlhRJM0qETA0sSZBJi6 NL06LB/x4pP1pkr5hM+nHbqALERS/RdGBX4LFwLV42zNHm773kZGTMi0FRTpGnCqx1a8ES1Krj+jy Uwd7x/eg==; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; i=@fubar.geek.nz; q=dns/txt; s=s790814; t=1782490678; h=from : subject : to : message-id : date; bh=ZQJK4tzQbTTh44AEWLMWSfxnlMumtc+WW4PSZBVYpXU=; b=dF1NMCh4m/8ph3fhqCwD77pTww+bBK0Rgovclus8fEueFWXycdjfOLi6LbtGVwnHVs8x6 o4xgvx+kCgG7YanAEAnDD0+hoCryxzLPBbNdPZDmmC0cADuXP2GZVHPYbPdRtuJkcWm3v9x 30rHaxCz83v3/1BtQR+SgXX0IE5MKvV7TKJvjNgvUfEcCmehYbN1nRKf6R+h4JCAGCWWEOb 7GaCXTDn2GMbvw/dqhwwmO7W5KNlWpbC1Gb02m17eqnfKLkIDALnNfIy3aMvOjPzwWFasLq SibALNOL/3ghtgcmkOUxoQUCVHvQWLCLe77Lgyg+Wk20VNmtEjl1+WFViATA== Received: from [10.139.162.187] (helo=SmtpCorp) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2-S2G) (envelope-from ) id 1wd9FG-cp4TDI-M9; Fri, 26 Jun 2026 16:17:34 +0000 Received: from [10.99.243.232] (helo=morbo.fubar.geek.nz) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.99.4) (envelope-from ) id 1wd9FG-4o5NDgrwEUd-lvTe; Fri, 26 Jun 2026 16:17:34 +0000 Received: from smtpclient.apple (unknown [217.155.216.176]) by morbo.fubar.geek.nz (Postfix) with ESMTPSA id AB1CE437E5; Fri, 26 Jun 2026 16:17:32 +0000 (UTC) From: Andrew Turner Message-Id: <0597BF15-5ECC-4B66-A6A8-B0B8D494EAFF@fubar.geek.nz> Content-Type: multipart/alternative; boundary="Apple-Mail=_BBBAD1CB-0CD7-4377-BB28-3F31178B7766" List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: Please revert b2e843161d Date: Fri, 26 Jun 2026 17:17:22 +0100 In-Reply-To: Cc: freebsd-hackers@freebsd.org To: Steve Kargl References: <09C557A3-7D0A-42D7-A463-9E4162D86758@fubar.geek.nz> X-Mailer: Apple Mail (2.3826.700.81) X-Smtpcorp-Track: nKNPPpEuJZNp.pSeK90MSJyET.pCsBxQMnmIg Feedback-ID: 790814m:790814amQcrys:790814sU8g0upBlx X-Report-Abuse: Please forward a copy of this message, including all headers, to X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:23352, ipnet:103.2.140.0/22, country:US] X-Rspamd-Queue-Id: 4gn16v3p69z449Y X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated --Apple-Mail=_BBBAD1CB-0CD7-4377-BB28-3F31178B7766 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 25 Jun 2026, at 23:32, Steve Kargl wrote: >=20 > On 6/25/26 10:57, Andrew Turner wrote: >>> On 25 Jun 2026, at 17:42, Steve Kargl wrote: >>>=20 >>> On 6/25/26 01:15, Andrew Turner wrote: >>>>> On 24 Jun 2026, at 19:58, Steve Kargl wrote: >>>>>=20 >>>>> Can someone with commit access please revert b2e843161dc3b? >>>>>=20 >>>>> git log -r b2e843161dc3b79777e873183447c92ed9c3703a >>>>> Author: Andrew Turner >>>>> Date: Tue Nov 2 11:31:17 2021 +0000 >>>>>=20 >>>>> Use a builtin where possible in msun >>>>>=20 >>>>>=20 >>>>> If one has a libm built with, e.g., -DUSE_BUILTIN_FMAF, >>>>> and then tries to debug code that uses fmaf() where the >>>>> compiler options include -fno-builtin, a segfault >>>>> occurs. I suggest purging all of the recent additions >>>>> of USE_BUILTIN_*. These are simply not needed as a compiler >>>>> will use a builtin (if available) instead of a function from >>>>> libm. >>>> What architecture and compiler are you using to build libm? >>>> I only enabled it on arm64 as both llvm and gcc will generate the = optimal assembly instruction. Other architectures and compilers the = builtin may generate a call to fmaf creating an infinite loop. >>>=20 >>> I'm using >>>=20 >>> % uname -a >>> FreeBSD hotrats 16.0-CURRENT FreeBSD 16.0-CURRENT #0 main-n284956- = de9fe28ab847: Fri Apr 10 10:15:09 PDT 2026 kargl@hotrats:/usr/obj/usr/ = src/amd64.amd64/sys/GENERIC amd64 >> I don=E2=80=99t expect it to work on amd64 in the general case. = Godbolt shows both GCC and Clang generating an infinite loop jumping to = its self [1]. It may work on some architecture levels, however I don=E2=80= =99t know enough about amd64 to know if it=E2=80=99s safe to enable. >=20 > Just checked godbolt. If one uses -O3 -fno-builtin with either gcc > or clang, the generate assembly includes a call to fmaf in libm.a. > If you build libm with -DUSE_BUILTIN_FMAF on arm and you use > -fno-builtin, does the resulting executable seg fault? I never claimed arm enables it. It is enabled for arm64 as both gcc and = clang generate an madd instruction [1]. It looks like it is possible to use it on 32-bit arm when targeting = armv8 & using clang however this would only be usable as a combat = library as most 32-bit arm hardware supported by the FreeBSD kernel is = armv7. Andrew [1] https://godbolt.org/z/4rThxM6he [2] https://godbolt.org/z/fa13bEonP --Apple-Mail=_BBBAD1CB-0CD7-4377-BB28-3F31178B7766 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 25 Jun 2026, at 23:32, Steve Kargl = <kargls@comcast.net> wrote:

On 6/25/26 10:57, Andrew Turner = wrote:
On 25 Jun 2026, at = 17:42, Steve Kargl <kargls@comcast.net> wrote:

On 6/25/26 = 01:15, Andrew Turner wrote:
On 24 Jun 2026, at 19:58, Steve Kargl = <kargls@comcast.net> wrote:

Can someone with commit access = please revert b2e843161dc3b?

  git log -r = b2e843161dc3b79777e873183447c92ed9c3703a
  Author: Andrew = Turner <andrew@FreeBSD.org>
  Date:   Tue = Nov 2 11:31:17 2021 +0000

  Use a builtin where = possible in msun


If one has a libm built with, e.g., = -DUSE_BUILTIN_FMAF,
and then tries to debug code that uses fmaf() = where the
compiler options include -fno-builtin, a = segfault
occurs.  I suggest purging all of the recent = additions
of USE_BUILTIN_*.  These are simply not needed as a = compiler
will use a builtin (if available) instead of a function = from
libm.
What architecture and compiler are you = using to build libm?
I only enabled it on arm64 as both llvm and gcc = will generate the optimal assembly instruction. Other architectures and = compilers the builtin may generate a call to fmaf creating an infinite = loop.

I'm using

% uname -a
FreeBSD hotrats = 16.0-CURRENT FreeBSD 16.0-CURRENT #0 main-n284956- de9fe28ab847: Fri Apr = 10 10:15:09 PDT 2026 kargl@hotrats:/usr/obj/usr/ = src/amd64.amd64/sys/GENERIC amd64
I don=E2=80=99t expect = it to work on amd64 in the general case. Godbolt shows both GCC and = Clang generating an infinite loop jumping to its self [1]. It may work = on some architecture levels, however I don=E2=80=99t know enough about = amd64 to know if it=E2=80=99s safe to enable.

Just checked godbolt.  If one uses -O3 = -fno-builtin with either gcc
or = clang, the generate assembly includes a call to fmaf in = libm.a.
If you build libm with = -DUSE_BUILTIN_FMAF on arm and you use
-fno-builtin, does the resulting executable seg = fault?

I never claimed arm enables it. = It is enabled for arm64 as both gcc and clang generate an madd = instruction [1].

It looks like it is possible = to use it on 32-bit arm when targeting armv8 & using clang however = this would only be usable as a combat library as most 32-bit arm = hardware supported by the FreeBSD kernel is = armv7.

Andrew

[1] <= a = href=3D"https://godbolt.org/z/4rThxM6he">https://godbolt.org/z/4rThxM6he

= --Apple-Mail=_BBBAD1CB-0CD7-4377-BB28-3F31178B7766--