From nobody Sat Apr 20 10:32:52 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 4VM7BY39Wgz5HW5m; Sat, 20 Apr 2024 10:32:53 +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 4VM7BY0V03z4Q8B; Sat, 20 Apr 2024 10:32:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713609173; 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=U4y/rX5mmLkLSc0SwrhBN0WcOV0vgIicAuRFKEG0haY=; b=d/FGLFYeQv+m1rr+531TU8MEIQJkzd+18USR1zcipfqSV5Yip1E0aGxgSb5+7GkG0T/45/ MV664q8OCJeeXLUu2fdUYUzJ7vwE6e2RbPISvLX0qApHfb6pmFeiT9OJZz0Wap5AHPuiUh 0xvyms7KbfmHaujcXVetD6xFPvd479Pky8HDbFZzxYSKEOhoO8avtlOU3jzHpQzQYRO/ht IqsRvq+R0AEcmWrEWR8urQU9vHFE84CO1zI7QgIAREinNg5puTgavlZJ79+Gfxe8JsRhnE xe1fRMsvOUoYt5wrqrQdzM3yI3ROjTHvXyx6Letd9mYR+/g3SzewC+4+UQ9nbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713609173; a=rsa-sha256; cv=none; b=WbPZYw3Ij+18NP5LwMKl954GYsOZUdWFgSDhahku29dGg3t508opKoGtzIjOHai2G/lKg+ 8pfTJkmuyYeycjiv2V/Cdsc3zjFlw15vINa95HJZE2WXaOO170C8muemaX0fkeS38n5ie5 Vn/UCKLI158GZcL1KBsD+oaNY1rglU/u6tZH5k9Djxz5WRHhh79DPaxIHYqpT3wTKJC291 qdLIqJTApICsss1wW68rIuhHkUmaqV1Guo3xFZ8RdgOJFoZt75YXk0KigB+E8yzViNYOUE ZRxPfrfmSY3ZcYB6wXn63rtWOGbXlwm6g+gkD+Tg9xBRRyofIZ7vnZECaciHOQ== 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=1713609173; 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=U4y/rX5mmLkLSc0SwrhBN0WcOV0vgIicAuRFKEG0haY=; b=N5shgQC1r6K1/k9K8Fl/6twtZeQ26zoXhPlIGygoGUN9T0lrDhlQOSNDIgvRZVIAHy/a2l 4rE+lNuO2J4OgYFSMJbtnW2EY/CRC1cfeKLMXF522YDL4NSF1+du91ucMEVR+Rkm2CiR1v GRZRlMJn2xFhMzSEA1v4SaHfGtMIj00++UrdTbGIVPOk4VieRXQj+PcO+kJ1kYv9dfDm1X AVRswBUdiKUC6bH1HGv/PXykGnoBvTDNeQJQIrcGzYlI0XWqTuA09d0y12rseCAmEsi5dz YuInO+T/uST+A6JJcmTXPUcGGmkuDchVFuu3b2N4k3kj67RUx6xpuTyNAthVbw== 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 4VM7BX6VbZzYhN; Sat, 20 Apr 2024 10:32:52 +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 43KAWq7h012154; Sat, 20 Apr 2024 10:32:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43KAWq2S012151; Sat, 20 Apr 2024 10:32:52 GMT (envelope-from git) Date: Sat, 20 Apr 2024 10:32:52 GMT Message-Id: <202404201032.43KAWq2S012151@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: 47020df00dd8 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 47020df00dd821a8102cfd7358408de0ed9b6f39 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=47020df00dd821a8102cfd7358408de0ed9b6f39 commit 47020df00dd821a8102cfd7358408de0ed9b6f39 Author: Dimitry Andric AuthorDate: 2024-04-17 20:20:47 +0000 Commit: Dimitry Andric CommitDate: 2024-04-20 10:03:26 +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 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