From nobody Sat Apr 20 10:34:59 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 4VM7Dz3BFsz5HWdX; Sat, 20 Apr 2024 10:34:59 +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 4VM7Dz1SWZz4TNf; Sat, 20 Apr 2024 10:34:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713609299; 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=tTjbmYBPpgvdnM7ki7wPoea3apO3phUGf0dz+7yVc4I=; b=nwPRo3a4/c4LVXAMGHAmKVqpe+ubs++Ude4WuikdK/jHrGsyw9gZ+A58sGJFQOsoMff/7m zIrl+5+/BUaSuMgGqFkhjq/tvDgyG4KkWPgj0tnZ+bp58blc8LZXzJDeCXJj9go2TTmke+ fglfmu/GzGs9m8INxDYBUBJweO2I6C+bi9dBzc5vwb34OZb+rvaMffqwlNsQ+2s7zFT+42 CpSBzIT2NK70JrwmIz2tQ9teLEyQ+VE+Mig/529Wdxojt+tqhnGRQVNvPiriTEERd8KUvE jEbNOP1WIcOAgG7du27HU5uPUD2av/0Olhq4DOTXYwqnIDAgXtS4J+sb1d0W3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713609299; a=rsa-sha256; cv=none; b=XqKHtWnaSGyI4hWcvD4SjF6AEuiRaXiGxX0TB0AZiGoh7jruaxvaCImidtiV5hQc+rk5EG is0Ll2rtgW+rDUM3TSOn6kv4CrM/cCWIY6JJjg43Gq4DCBln6G0tUnSOQcZ3A6UfahoFWv lc4gxi0gB/hoLZtf8uarV+rdoKl5oDUdUEw9Of/1syKMWmmhX+UThMBDtlc8eAN3wbCa0Q ZP446qoMeAl2csptcW+QhA70sIakRHbaXB8Vcz9NlQLjfm5/IwzgsttwIsnBK+8ZVUL9Fs q2EDQScYic/6oO6S4RB95VLVW6IFgkSz2tnu5niOYwKjgU7MTQkkPs+8xFiolg== 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=1713609299; 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=tTjbmYBPpgvdnM7ki7wPoea3apO3phUGf0dz+7yVc4I=; b=Yln5VyJDYRvq751baFHtW58yKpz0Dtzgi2hb/Op/Ro9dmmckrwTfDzP7Kca3CgJnRhlLSG +juz8K6/smQOxoEH8bJjrVQgFjgeajYSu3220KLP4+cLLr/HNUbeJbJtnQuzWBEFPZGeLv dD3AegqaW/hYWwNBZWnKQcswFi30Hmq8pCetD+K9Yw8C1lx34XVBLs5GEFELIApTki6wTo v7gNUvo9GpuN1n3bZa4iGNcmlaSa7BDhakJ6BqgoPDYWYE9GDrHu82FfQiB1n/4H0yZgLD 3GPZT/tdyZJL9Qe0yaVwV+N6gv0Feb1i55PJU5LWo/9xFvSzoPoHNNRk+oAoyw== 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 4VM7Dz0nSHzYrL; Sat, 20 Apr 2024 10:34:59 +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 43KAYxBx014819; Sat, 20 Apr 2024 10:34:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43KAYxrD014816; Sat, 20 Apr 2024 10:34:59 GMT (envelope-from git) Date: Sat, 20 Apr 2024 10:34:59 GMT Message-Id: <202404201034.43KAYxrD014816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 50fd2fbec96c - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 50fd2fbec96c46961addac790c10c1d49d3673f9 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=50fd2fbec96c46961addac790c10c1d49d3673f9 commit 50fd2fbec96c46961addac790c10c1d49d3673f9 Author: Dimitry Andric AuthorDate: 2024-04-17 20:20:47 +0000 Commit: Dimitry Andric CommitDate: 2024-04-20 10:29:10 +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 (cherry picked from commit f276adc148433d009d198c2ebccdd3303377e237) --- 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 c0dacb5c9d7e..4fc02bae5710 100644 --- a/lib/libcompiler_rt/Makefile.inc +++ b/lib/libcompiler_rt/Makefile.inc @@ -228,13 +228,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