From nobody Tue Oct 4 15:02:05 2022 X-Original-To: freebsd-arch@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 4Mhgsn1Skvz4f2vy for ; Tue, 4 Oct 2022 15:02:21 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mhgsl3J5gz3rCP; Tue, 4 Oct 2022 15:02:19 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-pj1-f44.google.com with SMTP id e11-20020a17090a77cb00b00205edbfd646so18882008pjs.1; Tue, 04 Oct 2022 08:02:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=Runx/p+++m/9K670Nuj9oU89utcrd+rUaLdRZqydh7o=; b=VWzLciDtjqcDq5Ar6KkLCDXuoaJOGsKkpUGa4K988wN59DhLuBC5p3w2r8ssznu5wt NdCgu6T4X91Hi/Srs+mo/CTWJJlVeQRF1l54+/Sfszuec0LLFpjEzTtEGud51LdJKicl eMIDyUdjn5Y5W9U1GFDH3KV5jth+xmB/7qOpjzXkdfi8qvywxHUYNWTtyjDubWEnyC8e pBYXwI0IlGSZmVMtrXvJaK5AjXZbcyDq95+YFbIIDO7Gr4dIS9YuS8Ekx98SdGmGIQE3 hU5opgrPw/MNMHHUEF2d7/q9SZB3FOpg4a0OSLqHJaVAR4YENPiQp64VGcVEZuY/DJJi XSTQ== X-Gm-Message-State: ACrzQf2K3DFch2ol5FmlpNvSQ2/SZP8y6XUjFxSVriPUuHYfdIoHLAjC KMU78Q2zlhjoAQDuEl0FDUewU6PUJmTRKS6k X-Google-Smtp-Source: AMsMyM7gHCKagGWKoFf9J128CYvwLRVWeJmwvvnOhdlEMKC4zJ/vOYFKlTePfAb0BeAqSyqQNyseDA== X-Received: by 2002:a17:90a:aa8c:b0:205:98b8:f8d5 with SMTP id l12-20020a17090aaa8c00b0020598b8f8d5mr151652pjq.159.1664895737854; Tue, 04 Oct 2022 08:02:17 -0700 (PDT) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com. [209.85.210.171]) by smtp.gmail.com with ESMTPSA id a3-20020a170902ecc300b00176a5767fb0sm9133145plh.94.2022.10.04.08.02.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Oct 2022 08:02:17 -0700 (PDT) Received: by mail-pf1-f171.google.com with SMTP id q7so5777153pfl.9; Tue, 04 Oct 2022 08:02:16 -0700 (PDT) X-Received: by 2002:a05:6a00:1312:b0:536:fefd:e64a with SMTP id j18-20020a056a00131200b00536fefde64amr27619875pfu.26.1664895736546; Tue, 04 Oct 2022 08:02:16 -0700 (PDT) List-Id: Discussion related to FreeBSD architecture List-Archive: https://lists.freebsd.org/archives/freebsd-arch List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arch@freebsd.org MIME-Version: 1.0 References: <20221003184310.GA20951@spindle.one-eyed-alien.net> In-Reply-To: <20221003184310.GA20951@spindle.one-eyed-alien.net> From: Alexander Richardson Date: Tue, 4 Oct 2022 16:02:05 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: enabling float128 support in clang? To: Brooks Davis Cc: freebsd-arch@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Mhgsl3J5gz3rCP X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of arichardson.kde@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=arichardson.kde@gmail.com X-Spamd-Result: default: False [-2.09 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.986]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RWL_MAILSPIKE_GOOD(-0.10)[209.85.216.44:from]; MIME_GOOD(-0.10)[text/plain]; RCVD_IN_DNSWL_NONE(0.00)[209.85.216.44:from,209.85.210.171:received]; MLMMJ_DEST(0.00)[freebsd-arch@freebsd.org]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCPT_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; R_DKIM_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_LAST(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TAGGED_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Mon, 3 Oct 2022 at 19:43, Brooks Davis wrote: > > TL;DR: Is there a reason not to enable float128 support in clang for > x86? > > Due to a build breakage with the flang runtime, I recently noticed that > unlike most other OSes we don't support float128 in clang. It's enable > in modern GCC and other OSes have it enable in clang: > - Hakiu 2018: https://reviews.llvm.org/D54901 > - Solaris 2018: https://reviews.llvm.org/D41240 > - WASM 2019: https://reviews.llvm.org/D57154 > - Dragonfly 2021: https://reviews.llvm.org/D111760 > - OpenBSD (history hard to find...) > > Is there a known reason not to enable this? > > Patch to enable below (I'm a bit skeptical of the __FLOAT128__ part as > GCC doesn't define it...) > > -- Brooks > > diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h > index c75f7d9fbafe..ea95f40e81a0 100644 > --- a/clang/lib/Basic/Targets/OSTargets.h > +++ b/clang/lib/Basic/Targets/OSTargets.h > @@ -232,6 +232,9 @@ protected: > // setting this to 1 is conforming even if all the basic source > // character literals have the same encoding as char and wchar_t. > Builder.defineMacro("__STDC_MB_MIGHT_NEQ_WC__", "1"); > + > + if (this->HasFloat128) > + Builder.defineMacro("__FLOAT128__"); > } > > public: > @@ -241,6 +244,7 @@ public: > default: > case llvm::Triple::x86: > case llvm::Triple::x86_64: > + this->HasFloat128 = true; > this->MCountName = ".mcount"; > break; > case llvm::Triple::mips: > I think this makes sense and may even motivate me to try and get the necessary library calls merged to compiler-rt (https://reviews.llvm.org/D98261). One thing to note is that your current patch will also enable float128 for AArch64 (and other targets), which I don't believe any other OS does. I think it makes sense to restrict it to just x86 to avoid executing code in the compiler that has not been well tested. I believe for all other supported architectures long double is the same as float128 so it probably doesn't make too much sense to enable it there anyway. Alex