From nobody Wed Apr 17 20:22:06 2024 X-Original-To: dev-commits-src-all@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 4VKXPq3B9dz5H4Kj; Wed, 17 Apr 2024 20:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VKXPq0w9Tz4Pdc; Wed, 17 Apr 2024 20:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713385327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bjFbycsLbtRqP0GRhNXC3pOCJ15f/emDwU2TQiiBBKg=; b=ossy46MRfvenCpJRQsDMLR/q+VBoL2ssZBXtqrcdsREc0BFOGGLqDIINlcEIGNTSFEKWV2 4Sl16BX7UDoX1XuSvOzlqzlXc4WRYG1e+KbAR26BbTAy5qdVSv5n8dOSjLS0Wn7tmqCrzr j0YtyKYx2In9YJe/JQNn+u0Xyj0LW5MULPGO39IUaRnGitXlbLBhgtEdW5pEaUfZx/zp1A uATacxI+3ZZwTasWtz8Jk7d7fQvWCnQapuIHeV7tNw7J5e5ERz/lntSExigoDNf0kZyA05 6sy++OiVZJqQxlqcqv+HxmlP2cRjnvYtKkIeu+7xQGnqZMA8rprkaoTYAHQt6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713385327; a=rsa-sha256; cv=none; b=IeRHvYu+tHjP6sdqj/kMgUca+1qKBOgjH9wHvqsHOX0e2hYB74y5/+yo+UH4uUK/s6X95G aqdfrWvTqb4roObapSQVc08Z5M21KuZQeGWJovuq8WOP4s+kqt0yzKZT7336tUvWcjupOO kyl7p6XusodJJYR8PcbM6JLtRbW7rftsEotB0EepGwNS9qp5C1emvV6kCr5LTq2OOP7H9T 21/ew/aRyfoDfpfOCiz612WkmYTFyvtnPcl36D3eydhnv05zfST+QYAmjQvMDUbj6m771/ YpZ0XHn7P6TMHv02el1xnqAr7hhTIMAIvjZF0MaSrguWVRhUiXe6rVbFtT7B5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713385327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bjFbycsLbtRqP0GRhNXC3pOCJ15f/emDwU2TQiiBBKg=; b=AsK6mFgBCMy069wdYDsDf4ClMQ8PWoYsYJwVD/ltBuPSLnD5B3SIMba6qlcepf1i1cdj26 SHj+Si9Okx6XMTCWdXZ7FIfCISmZyWFLhcxkYjBIHMHPWJQHPqADQ9rZTIvOamgvKXymCm AJqH44Py/AVHczdCrWKufZzRke60MI8Cxf7D04bpVLkc3VeGZem1cmK3mNMc+uasjnWuWZ e19qlCboKpjnczLMafFJt/Pnp5dbILr74+NUzNxuhUIulKECmayyXALxojbwnhocS2NaMM l8MmEeRocCCLbVurqFo13cHTjJcflfIeVjszWyeaDwFUb/mhfHZRxpVPHgyFbg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VKXPq08rCzgV0; Wed, 17 Apr 2024 20:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43HKM6d3094141; Wed, 17 Apr 2024 20:22:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43HKM6r7094138; Wed, 17 Apr 2024 20:22:06 GMT (envelope-from git) Date: Wed, 17 Apr 2024 20:22:06 GMT Message-Id: <202404172022.43HKM6r7094138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: f276adc14843 - main - libcompiler_rt Makefile.inc: update _Float16/__bf16 checks List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f276adc148433d009d198c2ebccdd3303377e237 Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=f276adc148433d009d198c2ebccdd3303377e237 commit f276adc148433d009d198c2ebccdd3303377e237 Author: Dimitry Andric AuthorDate: 2024-04-17 20:20:47 +0000 Commit: Dimitry Andric CommitDate: 2024-04-17 20:20:47 +0000 libcompiler_rt Makefile.inc: update _Float16/__bf16 checks Clang supports __bf16 for riscv from version 18.0 onwards, so update the checks for it. While here, rewrite the checks so they are hopefully more readable, and also handle gcc a little better. In addition, define COMPILER_RT_HAS_FLOAT16 and COMPILER_RT_HAS_BFLOAT16 when these features should be available, since there are some parts in compiler-rt that check for these defines. PR: 276104 MFC after: 1 month --- lib/libcompiler_rt/Makefile.inc | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/lib/libcompiler_rt/Makefile.inc b/lib/libcompiler_rt/Makefile.inc index 47d87b71ea77..9aea0f2b051a 100644 --- a/lib/libcompiler_rt/Makefile.inc +++ b/lib/libcompiler_rt/Makefile.inc @@ -226,13 +226,36 @@ SRCF+= comparedf2 SRCF+= comparesf2 .endif +# Helper to reduce complexity of _Float16 and __bf16 statements below. +.if ${MACHINE_CPUARCH} == "aarch64" || \ + ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "arm" || \ + (${MACHINE_CPUARCH} == "i386" && !empty(MACHINE_CPU:Msse2)) +CRT_COMMON_F16_ARCH=t +.endif + +# +# _Float16 support, only on some architectures, and with certain compiler +# versions. +# +.if ((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 150000) && \ + (defined(CRT_COMMON_F16_ARCH) || ${MACHINE_CPUARCH} == "riscv")) || \ + ((${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 120000) && \ + (defined(CRT_COMMON_F16_ARCH))) +CFLAGS+= -DCOMPILER_RT_HAS_FLOAT16 +.endif + # -# bfloat16 support, only used on some architectures. +# __bf16 support, only on some architectures, and with certain compiler +# versions. # -.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "arm" || (${MACHINE_CPUARCH} == "i386" && \ - !empty(MACHINE_CPU:Msse2)) || ${MACHINE_CPUARCH} == "riscv") && \ - !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 130000) +.if ((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 150000) && \ + (defined(CRT_COMMON_F16_ARCH))) || \ + ((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000) && \ + ${MACHINE_CPUARCH} == "riscv") || \ + ((${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 130000) && \ + (defined(CRT_COMMON_F16_ARCH))) +CFLAGS+= -DCOMPILER_RT_HAS_BFLOAT16 SRCF+= truncdfbf2 SRCF+= truncsfbf2 .endif