From patchwork Fri May 13 16:35:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 1630828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tBbsD4Fd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L0DpB071Vz9sBF for ; Sat, 14 May 2022 02:37:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 91FA3383D839 for ; Fri, 13 May 2022 16:37:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 91FA3383D839 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652459855; bh=rW0p1pDbw+x9MpGU2qf3wtNMbTIUoQHm6xbPVw83juo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=tBbsD4Fdc4mvzcWXdlSlz8Ih+uu/HfWeEpePM4qi6aMdO8jdUUfiO33A/Vas7E+na U40KdO3Bov2tKjcNDFPeemueNbMH9CTDtzuDGSI+prFVTvpIX60F69hcnQUGp3A9T0 No36/+pkMVZ8MdL2Wdl94YvdDnziC1fuWq1h5XeQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2066.outbound.protection.outlook.com [40.107.20.66]) by sourceware.org (Postfix) with ESMTPS id 43329383D82E for ; Fri, 13 May 2022 16:36:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 43329383D82E ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=RW7lUvM0A+EevokOyVZ6d/4vfJnQwBds8XxkoEI+gT84GLJKYCy3bJrPfXsaJhdePOUtvQE5c7+sFtGmcz6HXppGTjBAP20mk86Sxi9Dzr8Q/LR+pXtnzqIjQb1WsJJaXIDTW/89/i3Q0XR6TvSj2xhwRJHv8UHaivscwvVpijVLY61mJPYKhICOo41zBfFR45mapJu/8hd5vYqP1vob5+UEl0Bx2X97HvRbPvq9CtopwJwmr8hQsb6tgBfeapWgV274pGdzjKWKlmFfZTFUahV5GxlmqKxF/2bbj6F5Nzi5GY/b2+TkVr8h3FvziswdDCdnSfKPkTbzfhTOT7DE0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rW0p1pDbw+x9MpGU2qf3wtNMbTIUoQHm6xbPVw83juo=; b=RLvhsWauE58GcOdcsRh+8nFIb8wpYKJJCuFVAwvibdp6Vj+o8nuGmz9CuwL15rP7A5q37tdNKR6eXPV7egjbtkvmTQBTLuKNCxYNMUY7lNzodJAYSgG26hRLesLkGRlOc2YQV72+XKwNu7OuWr/LQJY86tpEIAhqqQZU5/czUnD/j5BJpxF3vROkxlSoN8AEsN2mEZKYobGZaE98dVHGogvycnW5aFJ6PtRW3/BVft2ZaWoRmfP4nba1XGwvB+W4wAa/HQV8he+t9DBTN1PTNsKmhzXclBNoQdOihfREMuSafkgpM8CfCzsQodw4+uqjcbpAblX0jiy9xNxu+NDSmw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AM6PR04CA0026.eurprd04.prod.outlook.com (2603:10a6:20b:92::39) by DB9PR08MB6602.eurprd08.prod.outlook.com (2603:10a6:10:23c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Fri, 13 May 2022 16:36:03 +0000 Received: from AM5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:92:cafe::11) by AM6PR04CA0026.outlook.office365.com (2603:10a6:20b:92::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.15 via Frontend Transport; Fri, 13 May 2022 16:36:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT018.mail.protection.outlook.com (10.152.16.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 16:36:02 +0000 Received: ("Tessian outbound 07c1c99345b0:v119"); Fri, 13 May 2022 16:36:02 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1ea087bb69ef8bde X-CR-MTA-TID: 64aa7808 Received: from 72b0cd2594be.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 82456C84-BA4F-4BA6-A2DD-88DFD231C372.1; Fri, 13 May 2022 16:35:56 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 72b0cd2594be.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 13 May 2022 16:35:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=euPT95iZnVojO0O0BPOrvggZ2ycPWh3fM+jaE0ZZikn7p49o8VL90VOUwTOV/ZAGdJJS2qALeBR9NgvaJTPMnsE/B9XEHTd/XLRQ7BUQ+dzhaGXNWyHqbKvazJzgoq4Nq1z6rPHU4oAzLiWE9218UH+UwgWt/NGhu8BHUSbCB7YnaF+1iHpD8iJXpN3k8tPqVFln6vkxeTly9CJDGPPTPvnI16cgLCW6GsPZxLDmFMJIU6zGwr1fZQbCH8+C6EOlm4Eku1NJIFWz/is0eragtouBuWEEcuDvLtw4qYK6zk4dh4ps7D4/6rdqKBLVqxbQESSY6Mu1hlISgq1N589DaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rW0p1pDbw+x9MpGU2qf3wtNMbTIUoQHm6xbPVw83juo=; b=Sbrq/F6Bpr1ErikTZx2ibM1wDTMEdw0EzWs0QrQAgk0mtsa2rWBTD9S7TW1xakPvHh8fYYu/Q6SZ6zvnD74Nf7Vl2lPaU+oQZ9farBUJr77jXkRMj5A3HO5CRcS06DGyIJ5AXDOh2PpnLqIGhA6eYzKYMS69wdPza9KD9Qhqa0Wql7oF3qHeYMEHnqHhQQuNqOMwDLQ60b2+UXe6A4RzLbLZZ3j/g4v7nxpaP937338zduSLwJsQcFNg2uxGM+vE8xm0JxPxoxPa/FxLsuMku79TduTqJzMVW2/Qsz+auP/enS5/uQrcOPeZMpF2cpJ4KlQ97aWXJHzfKpsuAQcQEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6P195CA0077.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::18) by AS8PR08MB6581.eurprd08.prod.outlook.com (2603:10a6:20b:33a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Fri, 13 May 2022 16:35:50 +0000 Received: from AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:86:cafe::5d) by AM6P195CA0077.outlook.office365.com (2603:10a6:209:86::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 16:35:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT031.mail.protection.outlook.com (10.152.16.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 16:35:50 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 13 May 2022 16:35:56 +0000 Received: from e129018.arm.com (10.57.33.200) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Fri, 13 May 2022 16:35:56 +0000 To: Subject: [PATCH v2 08/10] testsuite: Add C++ unwinding tests with Decimal Floating-Point Date: Fri, 13 May 2022 18:35:53 +0200 Message-ID: <20220513163553.317619-1-christophe.lyon@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509143507.239804-9-christophe.lyon@arm.com> References: <20220509143507.239804-9-christophe.lyon@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: f87f4832-e2f6-4099-c543-08da34feab70 X-MS-TrafficTypeDiagnostic: AS8PR08MB6581:EE_|AM5EUR03FT018:EE_|DB9PR08MB6602:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: scRpLuEOLhS+VTdwqI3dTxk7ekTG7fIeMj88xGNc8bjADBc//GwT9uZnZgnFwq5sMh0dgBWpendGowdiqMMhu6XBoXySvdkdi9xagtuXUTsZvv9KMoSyIP1f+Qv9xzNEsU6rxDGs/5zr2JXcdXbTjDywfF8mQfS12pK8EgZMgZ9EVV5OPKKgrD3GPsPlanExfYc95hE/FHbqLfI/sm/53kQboZ6k+gRkIic7sm6iIAbnoGAaIBA1cvom3UvvvajZ0HOsS3XaHt2vWpbMNLanuKbqKhmYowNPVX2apgfj35iDMit+becYdIAf3mm7KLRfk7KL4bVL3La6gEmmupm1HJ74AK2z8ZWkKIrUKxzqYvfpgIBUSR0CO8+LS6uHajfFX+SeGmnU9CH1ATnULYpK6CaPqzEf/1f1wAiYgl6rL8OmJuBjPLRFR6+pn9sY9Xe+Yzsu/MfWNixzh1qVZ1wUjA76YsRyunyBVoUya/Vxi6Vokvcd4Y3xmtQMaFV0C4whqKZRv0JaKqoVDleCkA5W2sy+CZYmF3I17WtX2gj1zS4SCqf79htzIPnic8TWWToVs5SSojcQ6O5ukN7LqsxAAeq2L0nM1HNiZjsCsFi3byNyobdVJ2t5zmJcUil6rBkuyitYqqMxR+OOBkzwVR3/ysDCXKeuoMttPfL+R3M75s+xXMRfU3SBOzC8k77XQZbQTqY5hPBZIGNOnNtiYzy9dA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(86362001)(26005)(2616005)(82310400005)(6666004)(7696005)(83380400001)(40460700003)(1076003)(336012)(426003)(47076005)(508600001)(186003)(36860700001)(70206006)(8676002)(4326008)(8936002)(70586007)(316002)(6916009)(44832011)(81166007)(5660300002)(356005)(2906002)(36756003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6581 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 913b6794-54a9-4cb3-6b9b-08da34fea426 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 27+9OI809gKiQMz5/b9nqpeCErO1Y9hI+z8Q08vIJ0zCZZg7eQeVMCVOEQMOqw0mxpbXfK6dTVh0jMqifzq9OY/2+gIFjfUcpMv9hPXi14sRnG4M0zH4ra9l4ztU0hfkamSKV72INp73J3Q4iKb+DYUsWx5E2qeYaQrTOTrOCeUnRh5+Cu+x0yp529h3Xa2w9mq52xJI/ECVUFT5jnmm+Pz0LyL91IBxHVTsG0A+aE8WseK1w9jfZu1PWOKWcj8eRuGsLdCVc9X2f0SCxJe6qpNxxCBo3TtvcMUfA+8RtXMOfs/N+zwcKvL6XXekVACH43GDRSgzjqRDsw7125F0pWMMqrz4VzeY+u5xiLHZ5KEW3R1/0jIlTuZEWIL/f5WBMjN1vuhCzArjm6E6GKZhLaeE5cNFOG99mNZ/r0Hi01RdysVUlDvhwRxe7Ew4naRsDwkxe6+4VI2hGquUTDzz0ghf6LbxrV2kyaMOoxjEtlyeplxUeScx0dyaE40uktk+lo7QFOZveXVIQ5XjhV+V2MEJsQ7outIfXCfG1GSpoMkzOCryPlQWM+zhyNdHoa4EccyyxlUaMzW4OEI/ISFhBeMuNz2ZztjitzBx0tzYT2p1os6obfz1Wm0CpDdJ8N0gV3VGlr5zfAxC2NN9jrx6hNSTozZH6O3nCaFbsp77SemWJYlMNQeNzDHlUyfGZU3/ X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(5660300002)(8936002)(44832011)(2906002)(81166007)(316002)(6916009)(4326008)(8676002)(70206006)(70586007)(83380400001)(1076003)(186003)(7696005)(26005)(2616005)(508600001)(336012)(47076005)(426003)(40460700003)(6666004)(36860700001)(82310400005)(86362001)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2022 16:36:02.8353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f87f4832-e2f6-4099-c543-08da34feab70 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6602 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christophe Lyon via Gcc-patches From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" These tests exercise exception handling with Decimal Floating-Point type. dfp-1.C and dfp-2.C check that thrown objects of such types are properly caught, whether when using C++ classes (decimalXX) or via GCC mode attributes. dfp-saves-aarch64.C checks that such objects are properly restored, and has to use the mode attribute trick because objects of decimalXX class type cannot be assigned to a register variable. 2022-05-03 Christophe Lyon gcc/testsuite/ * g++.dg/eh/dfp-1.C: New test. * g++.dg/eh/dfp-2.C: New test. * g++.dg/eh/dfp-saves-aarch64.C: New test. --- gcc/testsuite/g++.dg/eh/dfp-1.C | 54 +++++++++++++++++++++ gcc/testsuite/g++.dg/eh/dfp-2.C | 54 +++++++++++++++++++++ gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C | 49 +++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 gcc/testsuite/g++.dg/eh/dfp-1.C create mode 100644 gcc/testsuite/g++.dg/eh/dfp-2.C create mode 100644 gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C diff --git a/gcc/testsuite/g++.dg/eh/dfp-1.C b/gcc/testsuite/g++.dg/eh/dfp-1.C new file mode 100644 index 00000000000..b0da13a4cc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/dfp-1.C @@ -0,0 +1,54 @@ +// { dg-do run } +// { dg-require-effective-target dfp } + +extern "C" void abort (); + +#include + +using namespace std::decimal; + +int +foo (double fp) +{ + if (fp < 32.0) + throw (decimal32)32; + if (fp < 64.0) + throw (decimal64)64; + if (fp < 128.0) + throw (decimal128)128; + return 0; +} + +int bar (double fp) +{ + try + { + foo (fp); + abort (); + } + catch (decimal32 df) + { + if (df != (decimal32)32) + abort (); + } + catch (decimal64 dd) + { + if (dd != (decimal64)64) + abort (); + } + catch (decimal128 dl) + { + if (dl != (decimal128)128) + abort (); + } + return 0; +} + +int +main () +{ + bar (10.0); + bar (20.0); + bar (100.0); + return 0; +} diff --git a/gcc/testsuite/g++.dg/eh/dfp-2.C b/gcc/testsuite/g++.dg/eh/dfp-2.C new file mode 100644 index 00000000000..aff0e03d1d9 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/dfp-2.C @@ -0,0 +1,54 @@ +// { dg-do run } +// { dg-require-effective-target dfp } + +extern "C" void abort (); + +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +int +foo (double fp) +{ + if (fp < 32.0) + throw (dec32)32; + if (fp < 64.0) + throw (dec64)64; + if (fp < 128.0) + throw (dec128)128; + return 0; +} + +int bar (double fp) +{ + try + { + foo (fp); + abort (); + } + catch (dec32 df) + { + if (df != (dec32)32) + abort (); + } + catch (dec64 dd) + { + if (dd != (dec64)64) + abort (); + } + catch (dec128 dl) + { + if (dl != (dec128)128) + abort (); + } + return 0; +} + +int +main () +{ + bar (10.0); + bar (20.0); + bar (100.0); + return 0; +} diff --git a/gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C b/gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C new file mode 100644 index 00000000000..79f6697dd10 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C @@ -0,0 +1,49 @@ +// { dg-do run { target aarch64*-*-* } } +// { dg-require-effective-target dfp } + +/* Test unwinding of AArch64 register saves. */ +/* We cannot use #include because it defines + decimal* types as classes, which we cannot be assigned to register + variables. Hence the use the mode attribute trick. */ + +#ifdef __aarch64__ + +typedef float dec64 __attribute__((mode(DD))); + +extern "C" void abort (void); +extern "C" void exit (int); + +void +foo (void) +{ + register dec64 v10 asm("v10") = 0; + register dec64 v11 asm("v11") = 1; + register dec64 v12 asm("v12") = 2; + register dec64 v13 asm("v13") = 3; + asm volatile ("" : "+w" (v10), "+w" (v11), "+w" (v12), "+w" (v13)); + throw ""; +} + +int +main (void) +{ + register dec64 v10 asm("v10") = 10; + register dec64 v11 asm("v11") = 11; + register dec64 v12 asm("v12") = 12; + register dec64 v13 asm("v13") = 13; + asm volatile ("" : "+w" (v10), "+w" (v11), "+w" (v12), "+w" (v13)); + try { + foo (); + } catch (...) { + asm volatile ("" : "+w" (v10), "+w" (v11), "+w" (v12), "+w" (v13)); + if (v10 != 10 || v11 != 11 || v12 != 12 || v13 != 13) + abort (); + } + exit (0); +} +#else +int +main (void) +{ +} +#endif From patchwork Fri May 13 16:34:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 1630827 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=xN1Gy+vF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L0DlL3PTcz9sBF for ; Sat, 14 May 2022 02:35:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C27563839C40 for ; Fri, 13 May 2022 16:35:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C27563839C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652459706; bh=SXBJ5zEfu8ltUNKpaEv2MVOo5D8UfipX1RcZiirBVmk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xN1Gy+vF4ILq0TurU3yiQDSj3PJm5BQDghdRcKMCqOWgHHgKTeLaPul8NOGbHtX02 MNPXkUBlpP+F5j+JkB4ikStDoh9u04SdayjGcNoiUBwoPO9YLmEiTTcKdS9z+fHWph ecCYfjZJetq70ZYByvDVn7BacjPHHd9AXd4ZyOks= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2054.outbound.protection.outlook.com [40.107.21.54]) by sourceware.org (Postfix) with ESMTPS id 26D32385843E for ; Fri, 13 May 2022 16:34:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 26D32385843E ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=HwyLGZSJApvExv855Rf021XHv5xiADXgoulH50F4ir51uTixRn0YOFjZln4AJco0SPBJ1iBG4NRYqXz9KdcZdzVS7dGdRjZfF700mluOCCZ2vVrgnrPoEVw5JesPnN3wHB1raEEpmn4bBYiZaxvjU5PqUdkujHsrutUT68a6kktNHN4It7Nc2hjdHO0GpHQgXe/4+NQ0OVKtWl8i9A7lV79WMcSLlI1nekv4MtAgNG0fuhrfX/XSZDqyhxE3mBhsQxPErv6RgdjH8m2oGFPKtM+K99od+E+FtzUDpIL86EzOB/AD6BOlnjaUUK5owE0zdeoRwu7J4YIWN0liM1ldxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SXBJ5zEfu8ltUNKpaEv2MVOo5D8UfipX1RcZiirBVmk=; b=COtTl5oT2cZiv5YEPx90tIdWdIwKum9dsYVyjPEPyrPD3y7R1rDzoR4NjIWBZ1c3z/09BCCoIwtj6EC7KqYlY/OB9Nqe90YiWo0L1IRl2yyN8BFQz5mY+t/W9Tn+qayWvGH1X7urhs658tMfC/R+75Jut+k9LQVMOUDNi2tCRQPICl2QQkHx3cjwrqOtP3vh2WTgUjZnNe86q3iTk6cNR0RVlLkIGFzKKxL7RrUmxPRK1oyV/DQkXXW8ehg3IVyn4v02452JURGYU2S7/Im5O+ahJiEvsGPxEmWzC5lfacv8FiuR+mtyENqNcGJVCbuif+lKANoigjIBeiZfu8qJwg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AS9PR06CA0499.eurprd06.prod.outlook.com (2603:10a6:20b:49b::23) by AM9PR08MB6984.eurprd08.prod.outlook.com (2603:10a6:20b:417::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Fri, 13 May 2022 16:34:29 +0000 Received: from AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49b:cafe::1f) by AS9PR06CA0499.outlook.office365.com (2603:10a6:20b:49b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 16:34:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT051.mail.protection.outlook.com (10.152.16.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 16:34:29 +0000 Received: ("Tessian outbound 9a0893f586e2:v119"); Fri, 13 May 2022 16:34:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 279931c275b55299 X-CR-MTA-TID: 64aa7808 Received: from 82653ed8df00.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 30554C83-8C29-4221-8367-AD457B88A2B9.1; Fri, 13 May 2022 16:34:17 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 82653ed8df00.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 13 May 2022 16:34:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZ/5NFt+DANYepAV/m1fZo/VfPPSQiLmDiOPV0VAkeBlt2JeAJhrUZeveh2xiYsa9BY3GYxRxaTg4OPVwGwINNjMrTtso8Y5VicpmevjgVObU9qlRaqfiQ/CiG9uPEidzt3BzPg57NZ7zV3/PuEXxCCA4QgK/O4WWqVfHrdhYJAP1MMU08ToAv6elHrLfXb8RHCj1uAwDWBKkvcX2PtKe0whLX/2zzYO0HDRtNCapUGdKxTc4B2xBFgd/jxgkRb47OtBjnpzkmzH6wiEEXygqOlXOPf4bBgyhDdb1H0AgML2V6UOoB8exy8PqpcuXsTD+UtZ48p920GBhG3w4gVfgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SXBJ5zEfu8ltUNKpaEv2MVOo5D8UfipX1RcZiirBVmk=; b=eJOgWjTIAjW5G/bEKK+t64Nb51aNdEoXsLMjhdSkfBtldYwloWyulTaJtB1sCX7eVmJMdubcXs2RhFVqXon4p77lhZsHNd7/fPLGAbJ7xxq6BZRSb0ZZTME1WMdd49b34CUu6bBSsaHgsVDigx3cM0AKD8oS7UwtZ/MpffkUWljSsKY1Q9LjAeEeugT0eHMkD371ShBbnBlQfX1U1k77i1M/CQuEYT4eoCd0yLhYEbMO9vlvvfhcswbXMxjXvPvzZ5KGpKxYSzJ/sUQVkaZ76A9f4/yE3nPHmUq2Rse8Fl3Z9BibK1CcYk5i5IWdpLvSoUzgqQVwT5nYmCtTrEJDzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS9PR06CA0099.eurprd06.prod.outlook.com (2603:10a6:20b:465::34) by DB8PR08MB5436.eurprd08.prod.outlook.com (2603:10a6:10:111::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13; Fri, 13 May 2022 16:34:15 +0000 Received: from VE1EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:465:cafe::7) by AS9PR06CA0099.outlook.office365.com (2603:10a6:20b:465::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 16:34:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT023.mail.protection.outlook.com (10.152.18.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 16:34:14 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 13 May 2022 16:34:19 +0000 Received: from e129018.arm.com (10.57.33.200) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Fri, 13 May 2022 16:34:19 +0000 To: Subject: [PATCH v2 09/10] libgcc: Add support for HF mode (aka __fp16) in libbid Date: Fri, 13 May 2022 18:34:07 +0200 Message-ID: <20220513163407.316503-1-christophe.lyon@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509143507.239804-10-christophe.lyon@arm.com> References: <20220509143507.239804-10-christophe.lyon@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 1fd4feed-e403-4198-f71a-08da34fe73d2 X-MS-TrafficTypeDiagnostic: DB8PR08MB5436:EE_|AM5EUR03FT051:EE_|AM9PR08MB6984:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: NHcG5cIjebtUZpYyHUbi5G8rnDWw0vrOyBm+vSRFKVDJEH1dcSMX9qdZbzPmiJMPEq0/UXVG8qH4rBnY57K1kFyJRMC2UHTsGTDk+N5r2qymD59Admoy4ealDzIyj97GYeB+qYmLDOkcY3EMfZgLOeHtVNFpdHKl0oSXHKo/44eiKuA/9TIIjNeMugGoSiXhGHZcmDGIY/Yc1bSsVq8ar4uOjNHN9ozO6Rs08g/TAAdoVBVXP7MIeYtoR4rPXZ+aM/QlYP7S0Z/SS1FjbZDELEiwjId37EYn9w9XMV5UYPA6u5lmStHl+RyS/ICnQE4Djd+qUPR5FMfoxbKs29nmWzbiAsS88cXA+o7UJcjhxBpbTzoX0I2QBLYHbCbqydl+ldeLaGTXgS9RQATV8+hE+CxBsXdwqXhzujLkz/CQwlftTzBbgGF/bnXCyabHi3zsk76yj4M2whrSIzHpr/X1nvfvkJ9OIEFSGTO0aR6tY7CRxB9r71czNZE7oVaeZH2NFOhHZYzzzqvohf5A1w3DIzMyl96zUxfaorbdUw6RUGMWSqGd2j9H3asl0K3OQPrurLswe3AKX82Rz6UV4UuJ1kl51mNrPjZGE63jEI0oDQPJu4fgT3TpMiFeN9qm86z/UAroLpYxzJ4heY5fpRPPRLulMszoME9H4RiwQfqe3DFoeElC6hIsqiiOd4iTRfyh364k1j1k5ZPPGhetH3TOweDIGtrILxISEjPSe9grohvHiTCNE5PeLePXB7MtK8fYWeyQgVSWL8Y81VfFODf2UhS0VX64R91Hmhlh3HY9wgS7lO1oQ1tqYQBzFmICSdfiNUi+fs2iBpuaDWgdnqZQoa9RDl+569FG3t/ebvWmcB0= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(316002)(70206006)(82310400005)(70586007)(4326008)(8676002)(6916009)(86362001)(84970400001)(356005)(81166007)(2906002)(30864003)(44832011)(8936002)(5660300002)(36860700001)(7696005)(83380400001)(26005)(6666004)(36756003)(186003)(47076005)(40460700003)(1076003)(508600001)(2616005)(336012)(426003)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5436 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: cc4dfdfa-5333-4ac3-4de7-08da34fe6aeb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2K0nXdqC6sPU0Uxm8WnUfu6TFEMp5Qx89sOgPmfmtrFhLSQsWx2olYjC9zb6+Zkl9w2OiQkqAhfAb6LTubzAhC2rKgGApJIe758Fi2OboAf/57aTpvevbZOLjMw+VzaWFwut0GXdkbzyG7rZO/Uh1HGftxsY/kEmsyOSsozhIA0hm3g83x8+IHU7Pqfu4mC1/P/CrrJr/8DziV6VKTbm0CGmmirsxMKMEb7RBTdCqvkbPuEZWKsM+b6y7WK3xb50MmFwwkfSMCdzTm9luw55whKXQgMEut8lmhp+cz4oGGKIMdnOqY2VnkiDECeIJnE8wr0mj9zXawyw9K4OfsvZQkM/jeSu94rxaCWM7esZMNC4n5pmOpCBSditgqG8iPOkm8mhFdhaIWz8KNt+oy8E72Z/h8hyEozGgZpDmYKbGcOmlyc+TZuIVF6A/XkUtXs3wmOWQWkerKZuKTKvOADZFNqb3f8miPPIruXDRlU9sZyRRqtc4Ex5PT7AtgKUNkvdfckQW+jKA1QlrnGF+DFk8oqbW1AjOppaFf8mxP4QUIw1h/akcXMsQg8U1WIMiFnNegWtAvspz1+q0JbnOIwKUbuci6WivRjq64UdRBcQ7CHP86wTBueaJsB3LqxidBVYan2TiamaqUEZm4ESw4xodQfgKUz1XdG8mHpgRB0FVOnaBbsQMkG+RMZdXoSis8LYrB3Ws2Z6AS0A6rtj1s2ACwNpiVDhFY+dzyUBt07c6CqwVaw4m7+Zje8obE8SimM26uOVzj3CEzrDwp7U9/TD2w2ZU51G6QaukQd1AqtYlQgYvBCjWPHP4Eq+Sqzjw9wo X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(426003)(336012)(47076005)(83380400001)(84970400001)(5660300002)(81166007)(44832011)(2906002)(30864003)(8936002)(1076003)(316002)(82310400005)(7696005)(86362001)(26005)(2616005)(6916009)(36860700001)(508600001)(8676002)(186003)(40460700003)(4326008)(6666004)(70206006)(70586007)(36756003)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2022 16:34:29.5108 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fd4feed-e403-4198-f71a-08da34fe73d2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6984 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christophe Lyon via Gcc-patches From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch adds support for trunc and extend operations between HF mode (__fp16) and Decimal Floating Point formats (_Decimal32, _Decimal64 and _Decimal128). For simplicity we rely on the implicit conversions inserted by the compiler between HF and SD/DF/TF modes. The existing bid*_to_binary* and binary*_to_bid* functions are non-trivial and at this stage it is not clear if there is a performance-critical use case involving __fp16 and _Decimal* formats. The patch also adds two executable tests for AArch64, to make sure the right functions are used, available (link phase) and functional. 2022-05-04 Christophe Lyon libgcc/ChangeLog: * Makefile.in (D32PBIT_FUNCS): Add _hf_to_sd and _sd_to_hf. (D64PBIT_FUNCS): Add _hf_to_dd and _dd_to_hf. (D128PBIT_FUNCS): Add _hf_to_td _td_to_hf. libgcc/config/libbid/ChangeLog: * bid_gcc_intrinsics.h (LIBGCC2_HAS_HF_MODE): Define according to __LIBGCC_HAS_HF_MODE__. (BID_HAS_HF_MODE): Define. (HFtype): Define. (__bid_extendhfsd): New prototype. (__bid_extendhfdd): Likewise. (__bid_extendhftd): Likewise. (__bid_truncsdhf): Likewise. (__bid_truncddhf): Likewise. (__bid_trunctdhf): Likewise. * _dd_to_hf.c: New file. * _hf_to_dd.c: New file. * _hf_to_sd.c: New file. * _hf_to_td.c: New file. * _sd_to_hf.c: New file. * _td_to_hf.c: New file. gcc/testsuite/ChangeLog: * gcc.target/aarch64/convert-dfp-2.c: New test. * gcc.target/aarch64/convert-dfp.c: New test. --- .../gcc.target/aarch64/convert-dfp-2.c | 42 +++++++++++++ .../gcc.target/aarch64/convert-dfp.c | 60 +++++++++++++++++++ libgcc/Makefile.in | 9 ++- libgcc/config/libbid/_dd_to_hf.c | 38 ++++++++++++ libgcc/config/libbid/_hf_to_dd.c | 36 +++++++++++ libgcc/config/libbid/_hf_to_sd.c | 36 +++++++++++ libgcc/config/libbid/_hf_to_td.c | 36 +++++++++++ libgcc/config/libbid/_sd_to_hf.c | 38 ++++++++++++ libgcc/config/libbid/_td_to_hf.c | 38 ++++++++++++ libgcc/config/libbid/bid_gcc_intrinsics.h | 30 +++++++++- 10 files changed, 358 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/convert-dfp-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/convert-dfp.c create mode 100644 libgcc/config/libbid/_dd_to_hf.c create mode 100644 libgcc/config/libbid/_hf_to_dd.c create mode 100644 libgcc/config/libbid/_hf_to_sd.c create mode 100644 libgcc/config/libbid/_hf_to_td.c create mode 100644 libgcc/config/libbid/_sd_to_hf.c create mode 100644 libgcc/config/libbid/_td_to_hf.c diff --git a/gcc/testsuite/gcc.target/aarch64/convert-dfp-2.c b/gcc/testsuite/gcc.target/aarch64/convert-dfp-2.c new file mode 100644 index 00000000000..ebbbc649455 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/convert-dfp-2.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-save-temps" } */ + +/* Test conversions from DFP to smaller types. */ + +_Decimal32 var32; +_Decimal64 var64; +_Decimal128 var128; +__fp16 var16; + +void foo32 (_Decimal32 param32) +{ + var16 = param32; +} + +void foo64 (_Decimal64 param64) +{ + var16 = param64; + var32 = param64; +} + +void foo128 (_Decimal128 param128) +{ + var16 = param128; + var32 = param128; + var64 = param128; +} + +int main () +{ + foo32 (var32); + foo64 (var64); + foo128 (var128); + return 0; +} + +/* { dg-final { scan-assembler-times {\tbl\t__bid_truncsdhf} 1 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_truncddhf} 1 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_truncddsd2} 1 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_trunctdhf} 1 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_trunctdsd2} 1 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_trunctddd2} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/convert-dfp.c b/gcc/testsuite/gcc.target/aarch64/convert-dfp.c new file mode 100644 index 00000000000..cd5ada46e3d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/convert-dfp.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-save-temps" } */ + +/* Test conversions to/from DFP values. */ + +extern void abort (); + +_Decimal32 var32 = 1.2df; + +int foo32 (_Decimal32 param32, _Decimal64 param64, _Decimal128 param128, __fp16 param16) +{ + return (param32 == var32) + + (param64 == var32) + + (param128 == var32) + /* Small enough relative difference? */ + + ((((_Decimal32)param16 - var32) / var32) < 0.002df); +} + +_Decimal64 var64 = 1.2dd; + +int foo64 (_Decimal32 param32, _Decimal64 param64, _Decimal128 param128, __fp16 param16) +{ + return (param32 == var64) + + (param64 == var64) + + (param128 == var64) + /* Small enough relative difference? */ + + ((((_Decimal64)param16 - var64) / var64) < 0.002dd); +} + +_Decimal128 var128 = 1.2dl; + +int foo128 (_Decimal32 param32, _Decimal64 param64, _Decimal128 param128, __fp16 param16) +{ + return (param32 == var128) + + (param64 == var128) + + (param128 == var128) + /* Small enough relative difference? */ + + ((((_Decimal128)param16 - var128) / var128) < 0.002dl); +} + +int main() +{ + if (foo32 (1.2df, 1.2dd, 1.2dl, (__fp16)1.2) != 4) + abort (); + + if (foo64 (1.2df, 1.2dd, 1.2dl, (__fp16)1.2) != 4) + abort (); + + if (foo128 (1.2df, 1.2dd, 1.2dl, (__fp16)1.2) != 4) + abort (); + + return 0; +} + +/* { dg-final { scan-assembler-times {\tbl\t__bid_extendsddd2} 2 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_extendsdtd2} 2 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_extendddtd2} 2 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_extendhfsd} 1 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_extendhfdd} 1 } } */ +/* { dg-final { scan-assembler-times {\tbl\t__bid_extendhftd} 1 } } */ diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 09b3ec8bc2e..1fe708a93f7 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -677,7 +677,8 @@ D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \ _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \ _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \ _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \ - _sd_to_dd _sd_to_td _unord_sd _conv_sd + _sd_to_dd _sd_to_td _unord_sd _conv_sd \ + _hf_to_sd _sd_to_hf D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \ _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \ @@ -685,7 +686,8 @@ D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \ _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \ _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \ _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \ - _dd_to_sd _dd_to_td _unord_dd _conv_dd + _dd_to_sd _dd_to_td _unord_dd _conv_dd \ + _hf_to_dd _dd_to_hf D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \ _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \ @@ -693,7 +695,8 @@ D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \ _si_to_td _di_to_td _usi_to_td _udi_to_td \ _td_to_sf _td_to_df _td_to_xf _td_to_tf \ _sf_to_td _df_to_td _xf_to_td _tf_to_td \ - _td_to_sd _td_to_dd _unord_td _conv_td + _td_to_sd _td_to_dd _unord_td _conv_td \ + _hf_to_td _td_to_hf ifeq ($(enable_decimal_float),bid) ifneq ($(D32PBIT),) diff --git a/libgcc/config/libbid/_dd_to_hf.c b/libgcc/config/libbid/_dd_to_hf.c new file mode 100644 index 00000000000..5e58288391e --- /dev/null +++ b/libgcc/config/libbid/_dd_to_hf.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +HFtype +__bid_truncddhf (_Decimal64 x) { + HFtype res; + union decimal64 ux; + + ux.d = x; + res = __bid64_to_binary32 (ux.i); + return (res); +} +#endif diff --git a/libgcc/config/libbid/_hf_to_dd.c b/libgcc/config/libbid/_hf_to_dd.c new file mode 100644 index 00000000000..f85100e24f8 --- /dev/null +++ b/libgcc/config/libbid/_hf_to_dd.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +_Decimal64 +__bid_extendhfdd (HFtype x) { + union decimal64 res; + SFtype xsf = x; + res.i = __binary32_to_bid64 (xsf); + return (res.d); +} +#endif diff --git a/libgcc/config/libbid/_hf_to_sd.c b/libgcc/config/libbid/_hf_to_sd.c new file mode 100644 index 00000000000..285b80c6e05 --- /dev/null +++ b/libgcc/config/libbid/_hf_to_sd.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +_Decimal32 +__bid_extendhfsd (HFtype x) { + union decimal32 res; + SFtype xsf = x; + res.i = __binary32_to_bid32 (xsf); + return (res.d); +} +#endif diff --git a/libgcc/config/libbid/_hf_to_td.c b/libgcc/config/libbid/_hf_to_td.c new file mode 100644 index 00000000000..99b661ec727 --- /dev/null +++ b/libgcc/config/libbid/_hf_to_td.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +_Decimal128 +__bid_extendhftd (HFtype x) { + union decimal128 res; + SFtype xsf = x; + res.i = __binary32_to_bid128 (xsf); + return (res.d); +} +#endif diff --git a/libgcc/config/libbid/_sd_to_hf.c b/libgcc/config/libbid/_sd_to_hf.c new file mode 100644 index 00000000000..e4e3125d49b --- /dev/null +++ b/libgcc/config/libbid/_sd_to_hf.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +HFtype +__bid_truncsdhf (_Decimal32 x) { + HFtype res; + union decimal32 ux; + + ux.d = x; + res = __bid32_to_binary32 (ux.i); + return (res); +} +#endif diff --git a/libgcc/config/libbid/_td_to_hf.c b/libgcc/config/libbid/_td_to_hf.c new file mode 100644 index 00000000000..c4ebe586db0 --- /dev/null +++ b/libgcc/config/libbid/_td_to_hf.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +HFtype +__bid_trunctdhf (_Decimal128 x) { + HFtype res; + union decimal128 ux; + + ux.d = x; + res = __bid128_to_binary32 (ux.i); + return (res); +} +#endif diff --git a/libgcc/config/libbid/bid_gcc_intrinsics.h b/libgcc/config/libbid/bid_gcc_intrinsics.h index b0a23debc15..f1fd90e18d7 100644 --- a/libgcc/config/libbid/bid_gcc_intrinsics.h +++ b/libgcc/config/libbid/bid_gcc_intrinsics.h @@ -31,6 +31,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "tm.h" #include "libgcc_tm.h" +#ifdef __LIBGCC_HAS_HF_MODE__ +#define LIBGCC2_HAS_HF_MODE 1 +#else +#define LIBGCC2_HAS_HF_MODE 0 +#endif + #ifdef __LIBGCC_HAS_XF_MODE__ #define LIBGCC2_HAS_XF_MODE 1 #else @@ -43,6 +49,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define LIBGCC2_HAS_TF_MODE 0 #endif +#ifndef BID_HAS_HF_MODE +#define BID_HAS_HF_MODE LIBGCC2_HAS_HF_MODE +#endif + #ifndef BID_HAS_XF_MODE #define BID_HAS_XF_MODE LIBGCC2_HAS_XF_MODE #endif @@ -53,6 +63,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Some handy typedefs. */ +#if LIBGCC2_HAS_HF_MODE +typedef float HFtype __attribute__ ((mode (HF))); +#endif /* LIBGCC2_HAS_HF_MODE */ typedef float SFtype __attribute__ ((mode (SF))); typedef float DFtype __attribute__ ((mode (DF))); #if LIBGCC2_HAS_XF_MODE @@ -98,6 +111,12 @@ typedef __attribute__ ((aligned(16))) struct #endif #endif +#if BID_HAS_HF_MODE +#ifndef HFtype +#define HFtype __float16 +#endif +#endif + #ifndef SFtype #define SFtype float #endif @@ -110,8 +129,7 @@ typedef __attribute__ ((aligned(16))) struct #ifndef XFtype #define XFtype long double #endif - -#endif /* IN_LIBGCC2 */ +#endif #if BID_HAS_TF_MODE #ifndef TFtype @@ -249,6 +267,14 @@ extern _Decimal128 __bid_extendxftd (XFtype); extern int isinfd32 (_Decimal32); extern int isinfd64 (_Decimal64); extern int isinfd128 (_Decimal128); +#if BID_HAS_HF_MODE +extern _Decimal32 __bid_extendhfsd (HFtype); +extern _Decimal64 __bid_extendhfdd (HFtype); +extern _Decimal128 __bid_extendhftd (HFtype); +extern HFtype __bid_truncsdhf (_Decimal32); +extern HFtype __bid_truncddhf (_Decimal64); +extern HFtype __bid_trunctdhf (_Decimal128); +#endif #endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */ extern void __dfp_set_round (int);