From patchwork Thu May 11 14:13:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jose E. Marchesi" X-Patchwork-Id: 92637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp4470866rwl; Thu, 11 May 2023 07:17:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ia6dHAy0C90agvww1RLCZrk73bA0e3XcZyPmq1wVmH+Ywx0bA4u1iv3kVg5DIR3v4MIeI X-Received: by 2002:a05:6402:10cc:b0:502:2494:b8fc with SMTP id p12-20020a05640210cc00b005022494b8fcmr15682418edu.7.1683814621898; Thu, 11 May 2023 07:17:01 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k8-20020aa7d8c8000000b0050bd2211c6asi2838205eds.374.2023.05.11.07.17.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 07:17:01 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=qy64F97F; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9DB043856267 for ; Thu, 11 May 2023 14:15:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DB043856267 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683814536; bh=XUW3KYM+wkYo6HU6ljHhLICsg6zh9T9TEbsvOVkm/gA=; 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=qy64F97F4DJdUKYFwDqatxkRd9AptSVCz3UFuOmARP/bCKIeIdXrnsmaTWPYK1dxP xpwBLhRIkCSd8+mWjlarGQBBst8MfkUpeklQvBIQJyzIhKwzVEko0FXoSaqYrQmO+E SjC+EniCaPoy6ZZ96mmiz1ZTsz4gGhKd2mKRy+ow= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id C8322385696B for ; Thu, 11 May 2023 14:14:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8322385696B Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34BDwgWc027630 for ; Thu, 11 May 2023 14:14:14 GMT Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qf77779cy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 11 May 2023 14:14:13 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34BCxBrm030587 for ; Thu, 11 May 2023 14:14:12 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qf81h7s7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 11 May 2023 14:14:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtb1AIEwHjxQ8s24WFt6bJtpypWCQrSd38WNJ6CfHB/lhHFuZQWmRHUNSkYd+MMTZXe/JfLEFMSaIpIEs4XJGHhtDB0pad2b5rouDQ+Bmdbqck6dFmCrYzuoC9WaCOSbSwciLZ6UNUoTOKwfMFVpwTAhIHgKptXlNZ8H9Pv3j3Bvka3Z2cqwFcvWUzVdmB6rjzWHEiWDUgbQkMqx5gl4T79Ws5Jv7qyi9kzIOY5JCgnGvIeOAWdDnkeyrzi9mJai4hmyAPJ3qQisaX2z99Lh9JVkdLwepDKCHK+oZr4SJWAyTLOjmswUGLjAgvW8Bxa6v1We0nV/CosRNHZoPgsnnA== 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=XUW3KYM+wkYo6HU6ljHhLICsg6zh9T9TEbsvOVkm/gA=; b=WbBVbz67Ta/95dJv0MDRiXwOVa29xtq9iZ27ZDESwg62DoLl9ZlaLZHw8GvxuRaD4BP/yf+mv8SKjcN4HwIaHIU+oIyHit7y9cBKOvL/OcdHgvrW04bONZ5nFAvdhYMnSzUs/RGmCVOiJms1jUXmCXXi+Q9qatj5e8Y7Xxg4n1mbVqQW5fevigt6SqFSm9dIjQU7yFnHW1tZ9d1lCI5eaLgBpI/VQgYbNmdq0Nbm0HrDXY+BjjvmyK6R6/p8J/k5PIHOHVJs228k2gZmvLOOzbgR7b4tYsX22bMyeBYp50buEer1AqAjNjXT9SKkOvMu9O4ILTwWgnu6QUNhv/FcEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) by DS0PR10MB7271.namprd10.prod.outlook.com (2603:10b6:8:f6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.31; Thu, 11 May 2023 14:14:10 +0000 Received: from BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::d8ec:1377:664:f516]) by BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::d8ec:1377:664:f516%7]) with mapi id 15.20.6363.033; Thu, 11 May 2023 14:14:10 +0000 To: binutils@sourceware.org Subject: [PATCH 4/4] gas: document V3 BPF atomic instructions in the GAS manual Date: Thu, 11 May 2023 16:13:51 +0200 Message-Id: <20230511141351.18886-5-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230511141351.18886-1-jose.marchesi@oracle.com> References: <20230511141351.18886-1-jose.marchesi@oracle.com> X-ClientProxiedBy: SA9PR13CA0039.namprd13.prod.outlook.com (2603:10b6:806:22::14) To BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB2888:EE_|DS0PR10MB7271:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dad8382-c48d-4821-1d84-08db5229fd30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sG3AxNixGMUIWGc01wQrIiO/XpVCbPD8krYZqFX9ATALpQ/ehswEK26RkjBoKSTJ1K+yFo3b/SAchTHc7uaRR7hdd78ni0SU3tzMVBx0kMqIci5rfx3P93Tnxzv/+TYi2kZCjeaPiYd1FUVV27LREQUdaY0o+p/SqM/eF5LcJ7J9poWXuMGxsk2Jiig6IiT1YjoK4TmNPD+VaSCwzOjgYcKHxWh1d65CiuVwZzr0PdQmXFHT6V21A4v3OoFrC3V0xIsoeoxAelXkiq92gKhCyVxHQ/FLorS0VFftqHrPtdT00ZAlTYy35sSqMb5MKLC+v853Z3VwzXZKgD79sWALq0IRW7PAbK9MjUsz2d0/EN1qrZtD5w2HX9dg0LKvbhhEXJWOjDefJeW0HRuqZ4fkDvL3RP/YrDXZnxkvxz1dzEzBmj5OELE98m+XkN8O72mnptPf5mwqH3eW+LxAhyW7NEPn5NZgNkzVCaKqJ5MliJR+hGb4Bnh+C+5zIR0h/hUvgzUbwQGEwMq4FfEXMj2gY7dacWWIZ/u5JfNhoAGVfhH7AparsK1a2ZeoHO64K78r X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2888.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(346002)(366004)(376002)(396003)(451199021)(2616005)(86362001)(83380400001)(186003)(36756003)(66476007)(6916009)(66946007)(66556008)(2906002)(6506007)(6512007)(1076003)(26005)(8936002)(8676002)(38100700002)(41300700001)(6486002)(316002)(6666004)(5660300002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TBRkFvPE5mU6bruXPZtH3C9rNTysxXN6UBPGZOthIXVsR6Tmh4oHIUNNuDjdj0+g3Y8dfiwiMIW+3xrTwDRbziBv6/CRfX4JlxJ/vONuYORExUMYB1+YFdWqNocUE7HFsoiUAGjct5y5d2l0mG+v0nhvdSonHKcgRUKZq5poODWwVenqleXh4gZnnANOYHr2Mqdh15IN1GVs/mEXKpXvEG7p6yLIQwAENcb+v8x/0hTNnnIRV/CVzDbXnSNfdcKDOB573tneqSRClm3pA0+k0rUBAFM438YMh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ETfLoCKOrgJEnIKVR0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dad8382-c48d-4821-1d84-08db5229fd30 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2888.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 14:14:09.9651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HKTYmugJxINi5bXIgJkz/qslYCJlVra8guLcCIWue9FvoZ+KD9c3eUABnxVjoe7sZPcYx4Jkc7SSLE1PAJPppIVXKZNP0GdNGzWt2iWJ4Yc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB7271 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-11_11,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305110123 X-Proofpoint-GUID: fJNm3kFhsSHrXxegaNNiO9bl4ObyPN8O X-Proofpoint-ORIG-GUID: fJNm3kFhsSHrXxegaNNiO9bl4ObyPN8O X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Jose E. Marchesi via Binutils" From: "Jose E. Marchesi" Reply-To: "Jose E. Marchesi" Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765607601092400706?= X-GMAIL-MSGID: =?utf-8?q?1765607601092400706?= gas/ChangeLog: 2023-05-10 Jose E. Marchesi * doc/c-bpf.texi (BPF Opcodes): Document the V3 BPF atomic instructions. --- gas/ChangeLog | 5 +++++ gas/doc/c-bpf.texi | 56 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index a16647bb4a4..987b0c8704f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2023-05-10 Jose E. Marchesi + + * doc/c-bpf.texi (BPF Opcodes): Document the V3 BPF atomic + instructions. + 2023-05-10 Jose E. Marchesi * testsuite/gas/bpf/atomic-v3.s: New file. diff --git a/gas/doc/c-bpf.texi b/gas/doc/c-bpf.texi index 0756796adc9..917e0dc1628 100644 --- a/gas/doc/c-bpf.texi +++ b/gas/doc/c-bpf.texi @@ -377,14 +377,60 @@ Terminate the eBPF program. @subsubsection Atomic instructions -Atomic exchange-and-add instructions are provided in two flavors: one -for swapping 64-bit quantities and another for 32-bit quantities. +BPF provides a set of instructions to perform arithmetic and logical +operations on stored data atomically. These are: @table @code -@item xadddw [%d+offset16],%s -Exchange-and-add a 64-bit value at the specified location. @item xaddw [%d+offset16],%s -Exchange-and-add a 32-bit value at the specified location. +@itemx xadddw [%d+offset16],%s +Add @code{%s} to the 32 or 64 bit signed integer stored in the +specified memory location and store the result, atomically. +@item xorw [%d+offset16],%s +@itemx xordw [%d+offset16],%s +Perform a bit-wise or operation between @code{%s} and the 32 or 64 bit +signed integer stored in the specified memory location and store the +result, atomically. +@item xxorw [%d+offset16],%s +@itemx xxordw [%d+offset16],%s +Perform a bit-wise xor operation between @code{%s} and the 32 or 64 bit +signed integer stored in the specified memory location and store the +result, atomically. +@end table + +@noindent +Additionally, the following instructions allow to perform arithmetic +and logical operations on stored data and then fetching the original +stored value in a register, atomically: + +@table @code +@item xfaddw [%d+offset16],%s +@itemx xfadddw [%d+offset16],%s +Add @code{%s} to the 32 or 64 bit signed integer stored in the +specified memory location, store the result, and set @code{%s} to the +value originally stored in the memory location, atomically. +@item xforw [%d+offset16],%s +@itemx xfordw [%d+offset16],%s +Perform a bit-wise or operation between @code{%s} and the 32 or 64 bit +signed integer stored in the specified memory location, store the +result, and set @code{%s} to the value originally stored in the memory +location, atomically. +@item xfxorw [%d+offset16],%s +@itemx xfxordw [%d+offset16],%s +Perform a bit-wise xor operation between @code{%s} and the 32 or 64 +bit signed integer stored in the specified memory location, store the +result, and set @code{%s} to the value originally stored in the memory +location, atomically. +@item xchgw [%d+offset16],%s +@itemx xchgdw [%d+offset16],%s +Exchange the 32 or 64 bit values in @code{%s} and the specified memory +location, atomically. +@item xcmpw [%d+offset16],%s +@itemx xcmpdw [%d+offset16],%s +Compare and exchange operation. Compare the 32 or 64 bit value stored +in the specified memory location to the contents of the @code{%r0} +register. If they are equal, store @code{%s} in the memory location. +In any case, update @code{%r0} with the original contents of the +memory location. @end table @node BPF Pseudo-C Syntax