From patchwork Mon Jun 17 21:28:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1948868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Y8njVOZD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W331Z55Mcz20XQ for ; Tue, 18 Jun 2024 07:29:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1C8E43882074 for ; Mon, 17 Jun 2024 21:29:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id D2DE43858C50 for ; Mon, 17 Jun 2024 21:29:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D2DE43858C50 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D2DE43858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718659756; cv=none; b=B2m7I0A+++7a5+ESAbJrWQVhPrR4hfxa33e1UGN3Jtkbz8gyxP6B0qvC9C82xTdoXcYvV7TTURrE8Dp+/sYVxR+G3uGbRRD9oqYRNfM7wZ2y9tQAQLzel4Sgt1Gwe6QAr/EAj48BMLZ3jd2aXbs2dD7jACSEpPVAejfJXeIpHMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718659756; c=relaxed/simple; bh=b6PiiaZA9m0K0bdRc0eMiuY32O7YRjd0LV7kkwzY8Cw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cCs4HvCb8lpy9UK+lXVOmeXJQ4uF8Qhyl7hHKKPQi4o6iTpmtXIYA81PBxtGHbMjII2I395Drc7ZsQuFdtpx6G+4T/GWxlx5BirKsDyt0JonzJwstAKSahTUoXBuSFv7x32MzLt8WzDf7wJ205qk58Pd+vuRiV/eVCJyGQRlWuA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-421d32fda86so50209225e9.0 for ; Mon, 17 Jun 2024 14:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718659752; x=1719264552; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=TRdfYEMsyHNkUmg/XRMAdFQlX5kCI1PdRQbKTGeggJk=; b=Y8njVOZDqf3MaxXSu2whhafbZq2NN+LYhiifUnJT3LoosJSwRNabgdicAhvO8mZ1Ny b4OxIrqol2lKW9B/bmMF1WOwn9BEw1fsOOcKFugSYi1i7eh8/mQnLR4mXgfCQhaDulwu xrFhup2K+S94ffNDv9HngRiOYP8tdLy3xd+5vfwt5tQyM4Z5V842xSCNit3kELhIxkX8 oUVZIJ4eoU2BgIOA2271WvSXOSuENyeFnSc50nuUvVxROkQwixI84qmo7NHj8xbh4Hd2 3euYWWwqiST7+Jac017jk6bFEi0RPbdo/htc8MMPNDIBUxPLJO7ViRGXhCJTcDc/xfB1 OPBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718659752; x=1719264552; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TRdfYEMsyHNkUmg/XRMAdFQlX5kCI1PdRQbKTGeggJk=; b=tLN3jcdPpLNOZwsDqCzGlarvOQNOa1aOcnHTjAw4ItTp/JOjEd1aPVOB4ztovxZza1 Nha22CPwT8YpQHbgaF7+4lFazIY7jb6a91PIGJZt8r+p3RtMd0hwQQNQvju7c5ih0Fzl b1EQNu7WeyK+kx/24YFmRnNVzAMv5c3s65jwYc07PiJxlQNvLj9yBP14WPEIyAy3NSXe T9VoiIsKFrNyWb6NaBAXd457UQsfL+z62praNyoIsUt3sXIoL52EJk4Ez2DJxoeKr5Fh f3qBaZG2fC1v1eZBUqvPukh6NdVrn3NBUVhXWbs19k+Hk80wHjb79S7AQgIULllgiaAJ /VTA== X-Gm-Message-State: AOJu0Yx9pl9jqAcwXze7eDkMi6IyMblsYRNMos+/eyLHKA09zu/Z9Lia HU6ZvdecPXhqrKWOULeUt3+2r6xRuLnjeyXHnxPW/l7C35PydRWjAz4y+eCSxAUGrUMLSfkCjS4 = X-Google-Smtp-Source: AGHT+IG3C9G4nDgtmLTVFU0rHDEN5drqWX+W15G9bY1y0TY8c8mb7sWsuEGKM41nMFQ30FmD9xQPCQ== X-Received: by 2002:a05:600c:32a7:b0:422:1a82:3ed2 with SMTP id 5b1f17b1804b1-423b506058amr74609685e9.27.1718659752478; Mon, 17 Jun 2024 14:29:12 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42286eef970sm204523765e9.10.2024.06.17.14.29.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 14:29:11 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [c-family] Add minimal support for __bf16 to -fdump-ada-spec Date: Mon, 17 Jun 2024 23:28:47 +0200 Message-ID: <4578992.LvFx2qVVIh@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested on x86-64/Linux, applied on the mainline. 2024-06-17 Eric Botcazou c-family/ * c-ada-spec.cc (is_float16): New predicate. (dump_ada_node) : Call it. diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc index a41e93aeafb..e1b1b2a4b73 100644 --- a/gcc/c-family/c-ada-spec.cc +++ b/gcc/c-family/c-ada-spec.cc @@ -2077,6 +2077,22 @@ dump_ada_enum_type (pretty_printer *pp, tree node, tree type, int spc) } } +/* Return true if NODE is the __bf16 type. */ + +static bool +is_float16 (tree node) +{ + if (!TYPE_NAME (node) || TREE_CODE (TYPE_NAME (node)) != TYPE_DECL) + return false; + + tree name = DECL_NAME (TYPE_NAME (node)); + + if (IDENTIFIER_POINTER (name) [0] != '_') + return false; + + return id_equal (name, "__bf16"); +} + /* Return true if NODE is the _Float32/_Float32x type. */ static bool @@ -2210,7 +2226,12 @@ dump_ada_node (pretty_printer *pp, tree node, tree type, int spc, break; case REAL_TYPE: - if (is_float32 (node)) + if (is_float16 (node)) + { + pp_string (pp, "Short_Float"); + break; + } + else if (is_float32 (node)) { pp_string (pp, "Float"); break;