From patchwork Thu Jul 28 14:30:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 56395 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B3E963856979 for ; Thu, 28 Jul 2022 14:31:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3E963856979 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659018681; bh=Sbj2Oq/dYqKWxCA50ToygLYZywgURx2jdZ1qU5m0Nhc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=JUqgwO0bOcrRmI3ZgF8MUunPHEAN8CxSOP//g3TJNhFBMUkTsNqsmpKDE6oXJ9sFI 1Cvh8eRAdaxWxMG1d4xoXnywY66qT3QFCRizgXEzDuWPRepQKCr3c9M3i5O5KadoAf ytT/wwwpP9jmZYlhZGxgz2l0lHdanAfze+AQeLhA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50079.outbound.protection.outlook.com [40.107.5.79]) by sourceware.org (Postfix) with ESMTPS id B636B38582BD for ; Thu, 28 Jul 2022 14:30:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B636B38582BD ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=XIZEGrAcIvhJ8xcCLG/hKOYwir/O8c6CrXxFQAOs8uVYqNX1QUB325SNszAVWzFW+exPS29jLlEM83CfeOqWwfLNpOk3B0jZGYHuXnWpIvZZ3tseTphez5waZzSnf3aqtmdHTO/EqWN5QNt/aE559rHIRYaxWfu8Z6Mu4iyHG8h8MhJRnvshlV9p4zgWJcLXfpes/Ncm43gCNKmVZR+yj8OvRBKCD1Js1H0CayD4pO0UR6FCvjtF+ll2/nCoEcVjcoQuni56fEs3+4+GURafNG/E05jHdq94d/fBOd5SA4zfAl62lhxbt/tuG4+7CqcEQxG1/kZXIgXM7iVZ5ZM6UQ== 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=Sbj2Oq/dYqKWxCA50ToygLYZywgURx2jdZ1qU5m0Nhc=; b=hYCVW5DfHHzf93NDQPgOY4snU+J0S8C4Gb0ogSFd0DHdBSEILViV3I3rrnMt3hAHYlh9XJ5/GKbL2QciZx84h/C+AUQyH8IQaq7OPF89llyhjByRDSmgTsl9xIPqbmH1fvNlnKR2Ln0BhWvqLoVIEQjc0tmH+vcRb1RBT6gPq8mSU11OYu8CGShkb6cynCWEfAXB5rG9w+XAuTHtK8LV0ojZypkNn9IB3godya5uYKj1JtWOGqxFh5uXoA6Lia2IOIAFl3ccGKJFRRjt6Tuntp1obNqFBFTgG3Mr/IwKHY3F3dpDjhkv5EVwOPDvQVzXEo6nWVgLPCViTKzheYpSrQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AM4PR0501CA0048.eurprd05.prod.outlook.com (2603:10a6:200:68::16) by VE1PR08MB4672.eurprd08.prod.outlook.com (2603:10a6:802:a3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Thu, 28 Jul 2022 14:30:42 +0000 Received: from VE1EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:200:68:cafe::9f) by AM4PR0501CA0048.outlook.office365.com (2603:10a6:200:68::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11 via Frontend Transport; Thu, 28 Jul 2022 14:30:41 +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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT063.mail.protection.outlook.com (10.152.18.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Thu, 28 Jul 2022 14:30:41 +0000 Received: ("Tessian outbound fccf984e7173:v123"); Thu, 28 Jul 2022 14:30:41 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 52639f9eb8ac6df7 X-CR-MTA-TID: 64aa7808 Received: from 9e94d7da8cfc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5FEEED72-F140-4837-94E5-5F747DB8AE69.1; Thu, 28 Jul 2022 14:30:34 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9e94d7da8cfc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Jul 2022 14:30:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJxQzGPip7US3T23+FlhnJ3u3yyOlZL74biQ1k8AQPRjnJx0lbxoIaABe5OEZ53uj2vxXZtN/ff/hh9TgBozn2IqxOOrbVpfvVbxkNgoHW5LxjT7X1fcOfwCZPEC8tAItkOn6FkM996+XwD6DBMwjyW7kSSYcQaU4CdWYTaAd6uQunRLBEgtNfIQC1n4yryWTKzVnah+9+advm6MpE3zyWiq5uzvIP9ix8AqlrNKbpl872/aAbPRD0/U4tiIcM/GLhfVL2iVLkHwTc59IuTw/1PAMVbebIr10z/6GXIkfI4ipYZdPIbU/F0vYKZz6DAIUgxvPU3hgIPkWlFj9qGsrA== 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=Sbj2Oq/dYqKWxCA50ToygLYZywgURx2jdZ1qU5m0Nhc=; b=dgXcqNBX149+PJLqjf7lhe7jf9r3r/HP5nF6P3Lwj4S4EbU1J367cFZgEwirRbJXuCEBlSVrHA/upwqUt3+OO4JxbRWUgcgiMTKVh0K5DW4T4WHvJ+VygZsG6wnqIiLOksv0QxJOcJi9x8n+hKo/TUUuW5TduI9ohcvonF6RbMYg/jshP7VNJ5Sztw1j6zc6CULign7413+sCeav9InQOPsVRfGT3vamhz+o98FqcahCQEneUZ24GtHaPbYB4W88wJGIHbDvwJS+flEg2VrOnh4lYFUu4INdV3QyPetkr5c4YpgWP6mDIFKaNzOyYmjJLXpn/nN2vzyzY5Jb09IBVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from AM5PR0801MB1668.eurprd08.prod.outlook.com (2603:10a6:203:3c::14) by DB6PR08MB2631.eurprd08.prod.outlook.com (2603:10a6:6:23::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.10; Thu, 28 Jul 2022 14:30:31 +0000 Received: from AM5PR0801MB1668.eurprd08.prod.outlook.com ([fe80::845f:5b9c:410a:f581]) by AM5PR0801MB1668.eurprd08.prod.outlook.com ([fe80::845f:5b9c:410a:f581%5]) with mapi id 15.20.5482.011; Thu, 28 Jul 2022 14:30:31 +0000 To: 'GNU C Library' Subject: [PATCH] Remove atomic-machine headers Thread-Topic: [PATCH] Remove atomic-machine headers Thread-Index: AQHYoo5VF3NgiY3ysUGfaI8wv0QDOg== Date: Thu, 28 Jul 2022 14:30:30 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-MS-Office365-Filtering-Correlation-Id: 2d5cc217-d576-4092-17a0-08da70a5bfe6 x-ms-traffictypediagnostic: DB6PR08MB2631:EE_|VE1EUR03FT063:EE_|VE1PR08MB4672:EE_ 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: 3ngX3tuQWh4nR1Pb+tBMRDGR/TLYG2+wfchmdHuIdIDALgKr/o4MyX9913umdFW7baS/p4xhoinULYTXrXu0zENel0+uKu2IYCf5ZMLoqiCOQQiMEh0lyznOFZ32ufxqk1P/aWRgEt/xei8oxWdVlmiScNMttMXfLHIBNbkWdrhzKzY9BqTZ0bpT90Dbfp7vm0DMopqBqHjGA6LFK62PADGbb9z+OQTD9Cl5bJMGdDHWIrUIoDv441grFXT1fICm8XoGYOyuAkNjMShGWQP4CyFiWTKO/Aci5o8Ha5ts3n93MyG8Ev5ka0Nge3fFaTTR8QWE/HHr0xOB5fAV0nH3y/iFk/tWqk34bUbpA4gCscvzzagk+XOtdIrD2JeqTAJgmrbmbB9Lo+6MaH7Y/7IuZ4kdkFe1w1cGu/IMH11VmI0Vksf6i8cEHkKMLRB+3+irXtSEWHI1Rk23F+WoPmJGPrcv8ZWupwliBj8Us2HIne/J8Phkr5wKWaTjNPj6TuLIocnBOCdGsqBfxSniT9Qt2Lo0+IAmFlGfj0PzrxilDChPU+CpMjbXVgwoZ8F4a+KvoHgN0oCKkT3bzU9N+2NLdI4361+OzA0BKt3aE3ahlaip0BFt7skSPn5CqTYTaXJnkKo6zlW+vdZt+LgD61xKLVUCA4xSOudXMH7EiqbJ9k51w1v5KrtsGhiiC0p6PhSLOLw/mYYIINKJPLOzA76lGcWX1a8dHxlaNRY+SkLJvz54EM/7m0M/8xKG+o+l3aDootIarC4OJZwmTy/U8YuWGXmQtxzG+rTmFG6hUSEHAToQVrhHyoadlXZ1JVzHqGijTxe2bxmJkKlpWoy8CB87hrobuNjtZidGULnV61KaNM0gl/HqIWwmx4rWBDFL/pEn X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR0801MB1668.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(366004)(39860400002)(396003)(136003)(346002)(376002)(122000001)(316002)(71200400001)(86362001)(38100700002)(33656002)(41300700001)(186003)(26005)(6506007)(7696005)(6916009)(478600001)(9686003)(30864003)(66446008)(8676002)(2906002)(55016003)(5660300002)(52536014)(66476007)(64756008)(76116006)(66946007)(91956017)(66556008)(8936002)(83380400001)(38070700005)(21314003)(2004002)(579004)(559001); DIR:OUT; SFP:1101; MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2631 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3eb75ca8-feb1-4fa1-e0f1-08da70a5b972 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 50m3wuTbv61P69nQ8czWmR6FgChe8BqvlbDAHZmk6MfDgF5pITSUQCqbEFtH64oqYBCb9S/qdh3DbsWv45cKC4Q8cbijGwD/tSG87Ls6m7G95e3tplEZSYqOsTixXCdzd84RzeS7IMBBl4agZT7Ka0bDjRBrWKORTjqxCHM3TXEeYZcBTHYTGKKYPGfYar7rFxl9uAeVDnwAb11pV/7z2ANWWheXLvE8QFyL5KA6heUA2r0FUSAY3sx4NnJ7T7Y59KLJoV0qVidSrUcx2bjzlE4S5kTNjSSE6tA4CmZrdfYqd+Y1ELOiC2CKQoY4uO1HfrIMv7C9s3KITIl3wk1ijo17/sXJLN3Pt6q2qOK83DqFumFAHdgYBoqsqiOnuApaUppb9YvXolqB3rWGwA+mI1IDNxVagSBVHvekw42QLgBL7ygRhPcDgOAsIlUrJmj0U3Zb6gBtcg1a+alXkG5VZo3qAw7iKtoZhIBVcnhxOU2yRoJT775NhoGr+12mqZ3yGm58E6GXv2B/Ce8kdO4mMNGMA26+OgV7W8tkepCHyKKPoBM7RzGykXOUPaoq+6p23bjBt2EPjA85qrE2TQ3rmWo2/wHs5UKdB1oV+fPjlOR84dasOILBq5qRDfWaWIdLlW86PypFh0e9d/GiWKcQ08yMuBjHV46ZjtWe+RcLY9XfK/LoPdFXmDP516uEpnT8UXZPKpDH8DSuh1UakB/9ReEnqQmN2Lw4M2u8qIkRAJa9I7JSaT9iDCTmaqG+WpR7EjEm8MTwnrdZ7UMbSCF2lcUpommKwueWex7yGZLnmOwLbpMH3gizSb68EL6malGcQ//CTip4GgrxX/jwxT0wGVnr4YBalP0AxF3cP9fqG5fd0KkWMgg4u1ao9M2hJOJf 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:(13230016)(4636009)(136003)(396003)(346002)(376002)(39860400002)(36840700001)(40470700004)(46966006)(40480700001)(82310400005)(52536014)(55016003)(2906002)(8936002)(30864003)(5660300002)(70586007)(6916009)(33656002)(70206006)(8676002)(86362001)(7696005)(26005)(9686003)(6506007)(316002)(186003)(478600001)(41300700001)(47076005)(356005)(40460700003)(336012)(81166007)(36860700001)(82740400003)(83380400001)(2004002)(21314003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2022 14:30:41.5757 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d5cc217-d576-4092-17a0-08da70a5bfe6 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: VE1EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4672 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wilco Dijkstra via Libc-alpha From: Wilco Dijkstra Reply-To: Wilco Dijkstra Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Remove the last few unnecessary defines from all the atomic-machine headers so almost all can be removed. Set __HAVE_64B_ATOMICS as part of configure - this is not only simpler but also more correct since it depends on the compiler and settings. Note that __atomic_always_lock_free is quite buggy, but the expression used works correctly, including on LLVM. Remove the odd ATOMIC_EXCHANGE_USES_CAS as it is only used once and set incorrectly by many targets. Passes regress on AArch64 and buildmanyglibc. diff --git a/config.h.in b/config.h.in index bf316439a03ed23091b6bee6dea25ed61d0b8d0f..83b5a3a4bda77da0a8f582a52db78b0bea1725a9 100644 --- a/config.h.in +++ b/config.h.in @@ -286,4 +286,7 @@ /* Define if -mmovbe is enabled by default on x86. */ #undef HAVE_X86_MOVBE +/* Set to 1 if 64 bit atomics are supported. */ +#define __HAVE_64B_ATOMICS 0 + #endif diff --git a/configure b/configure index ff2c406b3b573484c843742d292fc2e0ee0e3008..3efdf45f99af71a482509f559d9de90aa294700c 100755 --- a/configure +++ b/configure @@ -727,6 +727,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -841,6 +842,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1093,6 +1095,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1230,7 +1241,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1383,6 +1394,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -6316,6 +6328,44 @@ if test "$libc_cv_gcc_builtin_memset" = yes ; then fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit atomic support" >&5 +$as_echo_n "checking for 64-bit atomic support... " >&6; } +if ${libc_cv_gcc_has_64b_atomics+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <<\EOF +typedef struct { long long t; } X; +extern void has_64b_atomics(void); +void f(void) +{ + X x; + /* Use address of structure with 64-bit type. This avoids incorrect + implementations which return true even if long long is not 64-bit aligned. + This works on GCC and LLVM - other cases have bugs and they disagree. */ + if (__atomic_always_lock_free (sizeof (x), &x)) + has_64b_atomics(); +} +EOF +if { ac_try='${CC-cc} -O3 -S conftest.c -o - | grep -F "has_64b_atomics" > /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; +then + libc_cv_gcc_has_64b_atomics=yes +else + libc_cv_gcc_has_64b_atomics=no +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_has_64b_atomics" >&5 +$as_echo "$libc_cv_gcc_has_64b_atomics" >&6; } +if test "$libc_cv_gcc_has_64b_atomics" = yes; then + $as_echo "#define __HAVE_64B_ATOMICS 1" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for redirection of built-in functions" >&5 $as_echo_n "checking for redirection of built-in functions... " >&6; } if ${libc_cv_gcc_builtin_redirection+:} false; then : diff --git a/configure.ac b/configure.ac index eb5bc6a1313acb3f3614645739adeb7638f19617..9e02b82d5215a05ac9ac0aea62da33efddab40f4 100644 --- a/configure.ac +++ b/configure.ac @@ -1443,6 +1443,32 @@ if test "$libc_cv_gcc_builtin_memset" = yes ; then AC_DEFINE(HAVE_BUILTIN_MEMSET) fi +AC_CACHE_CHECK(for 64-bit atomic support, libc_cv_gcc_has_64b_atomics, [dnl +cat > conftest.c <<\EOF +typedef struct { long long t; } X; +extern void has_64b_atomics(void); +void f(void) +{ + X x; + /* Use address of structure with 64-bit type. This avoids incorrect + implementations which return true even if long long is not 64-bit aligned. + This works on GCC and LLVM - other cases have bugs and they disagree. */ + if (__atomic_always_lock_free (sizeof (x), &x)) + has_64b_atomics(); +} +EOF +dnl +if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "has_64b_atomics" > /dev/null]); +then + libc_cv_gcc_has_64b_atomics=yes +else + libc_cv_gcc_has_64b_atomics=no +fi +rm -f conftest* ]) +if test "$libc_cv_gcc_has_64b_atomics" = yes; then + AC_DEFINE(__HAVE_64B_ATOMICS, 1) +fi + AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl cat > conftest.c <<\EOF extern char *strstr (const char *, const char *) __asm ("my_strstr"); diff --git a/include/atomic.h b/include/atomic.h index e9ec063228b5aeeccb4c5d14d7c894f00617eefb..48cc222e0325bfdbbfb64b4100e7d3c03f47dc05 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -27,11 +27,6 @@ - support functions like barriers. They also have the prefix "atomic_". - Architectures must provide a few lowlevel macros (the compare - and exchange definitions). All others are optional. They - should only be provided if the architecture has specific - support for the operation. - As macros are usually heavily nested and often use local variables to make sure side-effects are evaluated properly, use for macro local variables a per-macro unique prefix. This file uses @@ -74,43 +69,18 @@ __atg11_oldval; }) #endif - -/* This is equal to 1 iff the architecture supports 64b atomic operations. */ -#ifndef __HAVE_64B_ATOMICS -#error Unable to determine if 64-bit atomics are present. -#endif - /* The following functions are a subset of the atomic operations provided by C11. Usually, a function named atomic_OP_MO(args) is equivalent to C11's atomic_OP_explicit(args, memory_order_MO); exceptions noted below. */ - -/* We require 32b atomic operations; some archs also support 64b atomic - operations. */ +/* Check atomic operations are lock free. Since this doesn't work correctly + on all targets (eg. if uint64_t is 4-byte aligned), use__HAVE_64B_ATOMICS + for 64-bit types. */ void __atomic_link_error (void); -# if __HAVE_64B_ATOMICS == 1 -# define __atomic_check_size(mem) \ - if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8)) \ - __atomic_link_error (); -# else -# define __atomic_check_size(mem) \ - if (sizeof (*mem) != 4) \ - __atomic_link_error (); -# endif -/* We additionally provide 8b and 16b atomic loads and stores; we do not yet - need other atomic operations of such sizes, and restricting the support to - loads and stores makes this easier for archs that do not have native - support for atomic operations to less-than-word-sized data. */ -# if __HAVE_64B_ATOMICS == 1 -# define __atomic_check_size_ls(mem) \ - if ((sizeof (*mem) != 1) && (sizeof (*mem) != 2) && (sizeof (*mem) != 4) \ - && (sizeof (*mem) != 8)) \ - __atomic_link_error (); -# else -# define __atomic_check_size_ls(mem) \ - if ((sizeof (*mem) != 1) && (sizeof (*mem) != 2) && sizeof (*mem) != 4) \ - __atomic_link_error (); -# endif +#define __atomic_check_size(mem) \ + if (!__atomic_always_lock_free (sizeof (*(mem)), 0) || \ + (sizeof (*(mem)) == 8 && __HAVE_64B_ATOMICS == 0)) \ + __atomic_link_error (); # define atomic_thread_fence_acquire() \ __atomic_thread_fence (__ATOMIC_ACQUIRE) @@ -120,20 +90,20 @@ void __atomic_link_error (void); __atomic_thread_fence (__ATOMIC_SEQ_CST) # define atomic_load_relaxed(mem) \ - ({ __atomic_check_size_ls((mem)); \ + ({ __atomic_check_size ((mem)); \ __atomic_load_n ((mem), __ATOMIC_RELAXED); }) # define atomic_load_acquire(mem) \ - ({ __atomic_check_size_ls((mem)); \ + ({ __atomic_check_size ((mem)); \ __atomic_load_n ((mem), __ATOMIC_ACQUIRE); }) # define atomic_store_relaxed(mem, val) \ do { \ - __atomic_check_size_ls((mem)); \ + __atomic_check_size ((mem)); \ __atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \ } while (0) # define atomic_store_release(mem, val) \ do { \ - __atomic_check_size_ls((mem)); \ + __atomic_check_size ((mem)); \ __atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \ } while (0) @@ -218,12 +188,4 @@ void __atomic_link_error (void); # define atomic_spin_nop() do { /* nothing */ } while (0) #endif -/* ATOMIC_EXCHANGE_USES_CAS is non-zero if atomic_exchange operations - are implemented based on a CAS loop; otherwise, this is zero and we assume - that the atomic_exchange operations could provide better performance - than a CAS loop. */ -#ifndef ATOMIC_EXCHANGE_USES_CAS -# error ATOMIC_EXCHANGE_USES_CAS has to be defined. -#endif - #endif /* atomic.h */ diff --git a/nptl/pthread_spin_lock.c b/nptl/pthread_spin_lock.c index 19d1759f9aa350d5a711ac8abe6f9db1464a1012..9122a260303a4356d7ee68274f04b542090de380 100644 --- a/nptl/pthread_spin_lock.c +++ b/nptl/pthread_spin_lock.c @@ -26,29 +26,12 @@ __pthread_spin_lock (pthread_spinlock_t *lock) int val = 0; /* We assume that the first try mostly will be successful, thus we use - atomic_exchange if it is not implemented by a CAS loop (we also assume - that atomic_exchange can be faster if it succeeds, see - ATOMIC_EXCHANGE_USES_CAS). Otherwise, we use a weak CAS and not an - exchange so we bail out after the first failed attempt to change the - state. For the subsequent attempts we use atomic_compare_and_exchange - after we observe that the lock is not acquired. - See also comment in pthread_spin_trylock. + atomic_exchange. We use acquire MO to synchronize-with the release MO store in pthread_spin_unlock, and thus ensure that prior critical sections happen-before this critical section. */ -#if ! ATOMIC_EXCHANGE_USES_CAS - /* Try to acquire the lock with an exchange instruction as this architecture - has such an instruction and we assume it is faster than a CAS. - The acquisition succeeds if the lock is not in an acquired state. */ if (__glibc_likely (atomic_exchange_acquire (lock, 1) == 0)) return 0; -#else - /* Try to acquire the lock with a CAS instruction as this architecture - has no exchange instruction. The acquisition succeeds if the lock is not - acquired. */ - if (__glibc_likely (atomic_compare_exchange_weak_acquire (lock, &val, 1))) - return 0; -#endif do { diff --git a/nptl/pthread_spin_trylock.c b/nptl/pthread_spin_trylock.c index f2b12f9b4fe34340c9a2e449f2652908a7ff469d..3bd870401cdb336fe05469c3944b82fa563869be 100644 --- a/nptl/pthread_spin_trylock.c +++ b/nptl/pthread_spin_trylock.c @@ -24,57 +24,8 @@ int __pthread_spin_trylock (pthread_spinlock_t *lock) { - /* For the spin try lock, we have the following possibilities: - - 1) If we assume that trylock will most likely succeed in practice: - * We just do an exchange. - - 2) If we want to bias towards cases where trylock succeeds, but don't - rule out contention: - * If exchange is not implemented by a CAS loop, and exchange is faster - than CAS, do an exchange. - * If exchange is implemented by a CAS loop, use a weak CAS and not an - exchange so we bail out after the first failed attempt to change the state. - - 3) If we expect contention to be likely: - * If CAS always brings the cache line into an exclusive state even if the - spinlock is already acquired, then load the value first with - atomic_load_relaxed and test if lock is not acquired. Then do 2). - - We assume that 2) is the common case, and that this won't be slower than - 1) in the common case. - - We use acquire MO to synchronize-with the release MO store in - pthread_spin_unlock, and thus ensure that prior critical sections - happen-before this critical section. */ -#if ! ATOMIC_EXCHANGE_USES_CAS - /* Try to acquire the lock with an exchange instruction as this architecture - has such an instruction and we assume it is faster than a CAS. - The acquisition succeeds if the lock is not in an acquired state. */ if (atomic_exchange_acquire (lock, 1) == 0) return 0; -#else - /* Try to acquire the lock with a CAS instruction as this architecture - has no exchange instruction. The acquisition succeeds if the lock is not - acquired. */ - do - { - int val = 0; - if (atomic_compare_exchange_weak_acquire (lock, &val, 1)) - return 0; - } - /* atomic_compare_exchange_weak_acquire can fail spuriously. Whereas - C++11 and C11 make it clear that trylock operations can fail spuriously, - POSIX does not explicitly specify this; it only specifies that failing - synchronization operations do not need to have synchronization effects - themselves, but a spurious failure is something that could contradict a - happens-before established earlier (e.g., that we need to observe that - the lock is acquired). Therefore, we emulate a strong CAS by simply - checking with a relaxed MO load that the lock is really acquired before - returning EBUSY; the additional overhead this may cause is on the slow - path. */ - while (atomic_load_relaxed (lock) == 0); -#endif return EBUSY; } diff --git a/sysdeps/aarch64/atomic-machine.h b/sysdeps/aarch64/atomic-machine.h deleted file mode 100644 index 2dc1c524e40e2e805161e6d9b1b385b85c53a5c8..0000000000000000000000000000000000000000 --- a/sysdeps/aarch64/atomic-machine.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _AARCH64_ATOMIC_MACHINE_H -#define _AARCH64_ATOMIC_MACHINE_H 1 - -#define __HAVE_64B_ATOMICS 1 -#define ATOMIC_EXCHANGE_USES_CAS 0 - -#endif diff --git a/sysdeps/alpha/atomic-machine.h b/sysdeps/alpha/atomic-machine.h deleted file mode 100644 index 7fbe5b87eebf323d38fe1349b02aa56fe199cab3..0000000000000000000000000000000000000000 --- a/sysdeps/alpha/atomic-machine.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include - -#define __HAVE_64B_ATOMICS 1 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/arc/atomic-machine.h b/sysdeps/arc/atomic-machine.h deleted file mode 100644 index 2d519e3bbfa9ce77f4a41e313b67a690569d032e..0000000000000000000000000000000000000000 --- a/sysdeps/arc/atomic-machine.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Low-level functions for atomic operations. ARC version. - Copyright (C) 2020-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _ARC_BITS_ATOMIC_H -#define _ARC_BITS_ATOMIC_H 1 - -#define __HAVE_64B_ATOMICS 0 - -/* ARC does have legacy atomic EX reg, [mem] instruction but the micro-arch - is not as optimal as LLOCK/SCOND specially for SMP. */ -#define ATOMIC_EXCHANGE_USES_CAS 1 - -#endif /* _ARC_BITS_ATOMIC_H */ diff --git a/sysdeps/arm/atomic-machine.h b/sysdeps/arm/atomic-machine.h deleted file mode 100644 index b172573ae74dc9d6c7618bfdb76f5fb0429469f8..0000000000000000000000000000000000000000 --- a/sysdeps/arm/atomic-machine.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Atomic operations. Pure ARM version. - Copyright (C) 2002-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#define __HAVE_64B_ATOMICS 0 -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/csky/atomic-machine.h b/sysdeps/csky/atomic-machine.h deleted file mode 100644 index 4a7dc63be2044990852c52500943c90c898363be..0000000000000000000000000000000000000000 --- a/sysdeps/csky/atomic-machine.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Atomic operations. C-SKY version. - Copyright (C) 2018-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef __CSKY_ATOMIC_H_ -#define __CSKY_ATOMIC_H_ - -#define __HAVE_64B_ATOMICS 0 -#define ATOMIC_EXCHANGE_USES_CAS 1 - -#endif /* atomic-machine.h */ diff --git a/sysdeps/ia64/atomic-machine.h b/sysdeps/ia64/atomic-machine.h deleted file mode 100644 index 6f31c7b2eea67b5d8766dea1c38df6eedc168ebf..0000000000000000000000000000000000000000 --- a/sysdeps/ia64/atomic-machine.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#define __HAVE_64B_ATOMICS 1 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 0 diff --git a/sysdeps/m68k/coldfire/atomic-machine.h b/sysdeps/m68k/coldfire/atomic-machine.h deleted file mode 100644 index 1503703ed36b825f6e9f2cb2ed1516cd80bd9947..0000000000000000000000000000000000000000 --- a/sysdeps/m68k/coldfire/atomic-machine.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _ATOMIC_MACHINE_H -#define _ATOMIC_MACHINE_H 1 - -/* If we have just non-atomic operations, we can as well make them wide. */ -#define __HAVE_64B_ATOMICS 1 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 - -#endif diff --git a/sysdeps/m68k/m680x0/m68020/atomic-machine.h b/sysdeps/m68k/m680x0/m68020/atomic-machine.h deleted file mode 100644 index d356b55c9f9082db8dde734c254e01a631201206..0000000000000000000000000000000000000000 --- a/sysdeps/m68k/m680x0/m68020/atomic-machine.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* GCC does not support lock-free 64-bit atomic_load/store. */ -#define __HAVE_64B_ATOMICS 0 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/microblaze/atomic-machine.h b/sysdeps/microblaze/atomic-machine.h deleted file mode 100644 index 4e7ccce21e59453f5233bdf82b22215d9a6d17b3..0000000000000000000000000000000000000000 --- a/sysdeps/microblaze/atomic-machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include - -#define __HAVE_64B_ATOMICS 0 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/mips/atomic-machine.h b/sysdeps/mips/atomic-machine.h deleted file mode 100644 index 1e611c2153996d28e14611c60189f52d0919b79c..0000000000000000000000000000000000000000 --- a/sysdeps/mips/atomic-machine.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Low-level functions for atomic operations. Mips version. - Copyright (C) 2005-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _MIPS_ATOMIC_MACHINE_H -#define _MIPS_ATOMIC_MACHINE_H 1 - -#include - -#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32 -#define __HAVE_64B_ATOMICS 0 -#else -#define __HAVE_64B_ATOMICS 1 -#endif - -/* MIPS is an LL/SC machine. However, XLP has a direct atomic exchange - instruction which will be used by __atomic_exchange_n. */ -#ifdef _MIPS_ARCH_XLP -# define ATOMIC_EXCHANGE_USES_CAS 0 -#else -# define ATOMIC_EXCHANGE_USES_CAS 1 -#endif - -#endif /* atomic-machine.h */ diff --git a/sysdeps/or1k/atomic-machine.h b/sysdeps/or1k/atomic-machine.h deleted file mode 100644 index 90a10867b3f9cf97a0f2f521f6759a0008ef5b82..0000000000000000000000000000000000000000 --- a/sysdeps/or1k/atomic-machine.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Atomic operations. OpenRISC version. - Copyright (C) 2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef __OR1K_ATOMIC_H_ -#define __OR1K_ATOMIC_H_ - -#include - -#define __HAVE_64B_ATOMICS 0 -#define ATOMIC_EXCHANGE_USES_CAS 1 - -#endif /* atomic-machine.h */ diff --git a/sysdeps/powerpc/powerpc32/atomic-machine.h b/sysdeps/powerpc/powerpc32/atomic-machine.h index 6a2aae8bdb34281144e6810924377a6a62857d15..5d1d1ca120530371daaf97d5d0c5b545b2327a78 100644 --- a/sysdeps/powerpc/powerpc32/atomic-machine.h +++ b/sysdeps/powerpc/powerpc32/atomic-machine.h @@ -33,6 +33,3 @@ #endif #define __ARCH_ACQ_INSTR "isync" - -#define __HAVE_64B_ATOMICS 0 -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/powerpc/powerpc64/atomic-machine.h b/sysdeps/powerpc/powerpc64/atomic-machine.h index 2932f889c5bc6d0fa49d5ad36875b50c27ad07e9..cdee4b84827bcb8455972302725edb3fb76a744c 100644 --- a/sysdeps/powerpc/powerpc64/atomic-machine.h +++ b/sysdeps/powerpc/powerpc64/atomic-machine.h @@ -33,6 +33,3 @@ #endif #define __ARCH_ACQ_INSTR "isync" - -#define __HAVE_64B_ATOMICS 1 -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/s390/atomic-machine.h b/sysdeps/s390/atomic-machine.h deleted file mode 100644 index 3e25dcf44126001382e3b98aa2f82d29e29f1424..0000000000000000000000000000000000000000 --- a/sysdeps/s390/atomic-machine.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifdef __s390x__ -# define __HAVE_64B_ATOMICS 1 -#else -# define __HAVE_64B_ATOMICS 0 -#endif - -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/sparc/atomic-machine.h b/sysdeps/sparc/atomic-machine.h index 1f0eb0a9b1171c06dc19dc21c4fe7de94adc4bce..7ea88d598b9a36735004fe03cb52e46fe4807140 100644 --- a/sysdeps/sparc/atomic-machine.h +++ b/sysdeps/sparc/atomic-machine.h @@ -19,15 +19,6 @@ #ifndef _ATOMIC_MACHINE_H #define _ATOMIC_MACHINE_H 1 -#ifdef __arch64__ -# define __HAVE_64B_ATOMICS 1 -#else -# define __HAVE_64B_ATOMICS 0 -#endif - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS __HAVE_64B_ATOMICS - #ifdef __sparc_v9__ extern void __cpu_relax (void); diff --git a/sysdeps/unix/sysv/linux/hppa/atomic-machine.h b/sysdeps/unix/sysv/linux/hppa/atomic-machine.h deleted file mode 100644 index 9c9fecbefef037e3b7e8c291e722d093b811dd69..0000000000000000000000000000000000000000 --- a/sysdeps/unix/sysv/linux/hppa/atomic-machine.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2003-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _ATOMIC_MACHINE_H -#define _ATOMIC_MACHINE_H 1 - -#define __HAVE_64B_ATOMICS 0 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 - -#endif -/* _ATOMIC_MACHINE_H */ diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h deleted file mode 100644 index 02e54847a42bfbc93ae1e07b7e32965be644daba..0000000000000000000000000000000000000000 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2010-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _ATOMIC_MACHINE_H -#define _ATOMIC_MACHINE_H 1 - -#include - -#define __HAVE_64B_ATOMICS 0 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 - -#endif diff --git a/sysdeps/unix/sysv/linux/nios2/atomic-machine.h b/sysdeps/unix/sysv/linux/nios2/atomic-machine.h deleted file mode 100644 index 4b4b714f93f4c4b9f7f650d70d2301299a45e2f5..0000000000000000000000000000000000000000 --- a/sysdeps/unix/sysv/linux/nios2/atomic-machine.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Low-level functions for atomic operations. Nios II version. - Copyright (C) 2012-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _NIOS2_ATOMIC_MACHINE_H -#define _NIOS2_ATOMIC_MACHINE_H 1 - -#define __HAVE_64B_ATOMICS 0 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 - -#endif /* _NIOS2_ATOMIC_MACHINE_H */ diff --git a/sysdeps/unix/sysv/linux/riscv/atomic-machine.h b/sysdeps/unix/sysv/linux/riscv/atomic-machine.h index b0ebe09ce1fa4e15064dd57d83cadb8a1976f86d..90c48b301e8dad46017fe8d6497756cdd74268c8 100644 --- a/sysdeps/unix/sysv/linux/riscv/atomic-machine.h +++ b/sysdeps/unix/sysv/linux/riscv/atomic-machine.h @@ -21,9 +21,6 @@ #ifdef __riscv_atomic -# define __HAVE_64B_ATOMICS (__riscv_xlen >= 64) -# define ATOMIC_EXCHANGE_USES_CAS 0 - /* Miscellaneous. */ # define asm_amo(which, ordering, mem, value) ({ \ diff --git a/sysdeps/unix/sysv/linux/sh/atomic-machine.h b/sysdeps/unix/sysv/linux/sh/atomic-machine.h deleted file mode 100644 index 71848194daa98ad0391c029a8c7d9dba5ba5fe3d..0000000000000000000000000000000000000000 --- a/sysdeps/unix/sysv/linux/sh/atomic-machine.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Atomic operations used inside libc. Linux/SH version. - Copyright (C) 2003-2022 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define __HAVE_64B_ATOMICS 0 - -/* XXX Is this actually correct? */ -#define ATOMIC_EXCHANGE_USES_CAS 1 diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h index 98541a2d06ff5e4aa8c789ab7405215097471971..303458d1296e4b1cd7cd654e0904ace0ffc52fae 100644 --- a/sysdeps/x86/atomic-machine.h +++ b/sysdeps/x86/atomic-machine.h @@ -21,17 +21,6 @@ #include /* For mach. */ -#ifdef __x86_64__ -# define __HAVE_64B_ATOMICS 1 -#else -/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the - i386 psABI supplement provides only 4-byte alignment for uint64_t - inside structs, so it is currently not possible to use 64-bit - atomics on this platform. */ -# define __HAVE_64B_ATOMICS 0 -#endif -#define ATOMIC_EXCHANGE_USES_CAS 0 - #define atomic_spin_nop() __asm ("pause") #endif /* atomic-machine.h */