From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by sourceware.org (Postfix) with ESMTPS id DC1A83858D20 for ; Wed, 15 Nov 2023 03:00:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC1A83858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DC1A83858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::834 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700017212; cv=none; b=B/zoGQIK+AaKvKk3y7k+LyGWKV+/wnLRD6xq7nk3pAT6MaS3gwbmB3mt5IP40W94JqPU2QOvchQGNPj4tfQrSKOfZVwofQY0Mesh1Iom06Min90R2IPCGuViJf4pWQPbLGOgMeTtNE/v69lZjcVNeURPYFZt5/a3jP1D21OS8k8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700017212; c=relaxed/simple; bh=V98eaG/1Gx4UORvcNr0p6D5l6JeVzxJC4m812kSEeuk=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=mdf8QtQHCXywkNLdnHAqmDXND3U14K/NeXLOgJ14bw2A6C5kH/zQ+9l1IiXQXGnB06HRTFN04W6PHghZZDnFgbrElBOekQBeJZKJHSI+pC+p+gsv7IUzeRWXUclP7jZrp3pQU9ix6hMApM/XZaq9e1Yf7/Fdn+MMQsAUCMhdYdY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-41cd4446cf5so40126441cf.3 for ; Tue, 14 Nov 2023 19:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700017210; x=1700622010; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=L8kqlAOrK6xQIZeBtrdtu9d4cKsE6VtTCZ3lXml9vx4=; b=WgnRjL8F5BlPVARmSQdHzE6ZNiDMQFLyVV2q1M4tAhacW6UqESH3htyOX9jr9uposc V6Ow5w2tOP0/zXP0hDkPFqqwYkirvlEop996VYNfGULEkdxQeys4LXcosxrSmvhXhjv/ W/ya1fUillhzH01/wz37VXEjqxVqefnmAq77klAaFyvioW+grmY5ciM/VWJNPOLHS6O/ hgUrQpDbWIq2xMuLR/2mMdxVTqvAnfDpR5IwklVnPuN1/a+pkqpXIFeOSpaqoyQuUEqa nKFs2UKEIxsTc+aw7m6QbuhKYrIPxr8D/KaxwHGH960b2JWdpLKQN/Pzc4jkMv9BdHAB PRwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700017210; x=1700622010; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=L8kqlAOrK6xQIZeBtrdtu9d4cKsE6VtTCZ3lXml9vx4=; b=C6cYcttahFmAhLjn88AFjk33e6l2LnImErw+tqfKghxnqeW/UDyOfZafEHo2lRvgfb x3RP4YsC4wAfssEuQysGvN4v27pT4KpFzugJtYYqHbHB7Dfcux4sHI4M/1KglLjDnP5G bStJa+/RhJdBkk9LpbCmuNXv4pox13Q39fRFi4rc1KwDSeGmdS8q7rIGxSgt+SEZiTUr jQ0xVBHNluG43Lu9WPw6MPktc8j2t4AJrPnVDvHhEl6KvuFEG8juL3zDjUxNRPTuVnox zVcupbIDh+jNs3jvWUIX3eISQBJTqaudpylt0+MzCFcHUVP6o29J0ybFxgd1fVryI7Ho 1Dlw== X-Gm-Message-State: AOJu0YwDSHEErwhJMcPNg2TaSx5ZpMP6QvKXrcN6ahtDxX1neg6gazNv hzzJN9RRfx83CXF3AaUFKJRPLVNExjxEAdqnwTvQbMDA X-Google-Smtp-Source: AGHT+IF4hawqKmdfs2aBQm8yKjgzfu83Un+xqLEBdL8z0nSiPJrTYpLMpEOZhqG8RH2RZ9lrLYXJu5dlKNI6xVE6BFg= X-Received: by 2002:ac8:57cb:0:b0:400:a2b8:1c97 with SMTP id w11-20020ac857cb000000b00400a2b81c97mr4908434qta.17.1700017209837; Tue, 14 Nov 2023 19:00:09 -0800 (PST) MIME-Version: 1.0 From: Julian Waters Date: Wed, 15 Nov 2023 10:59:33 +0800 Message-ID: Subject: [RFC][C++] Attribute gnu::extended To: gcc-patches@gcc.gnu.org Content-Type: multipart/alternative; boundary="000000000000e78bc4060a281932" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000e78bc4060a281932 Content-Type: text/plain; charset="UTF-8" I propose a new attribute for C++, labelled gnu::extended. This attribute is for asm declarations, and the attribute marks them as extended asm. This attribute shall contain all of the features of existing extended asm, but also have additional features, described below. gnu::extended(OutputOperands, InputOperands, Clobbers, Labels, Attributes) OutputOperands - Output Operands, in the exact same syntax as existing extended asm Example: [result] "r" (variable) InputOperands - Input Operands, in the same syntax as existing extended asm. Different from extended asm is the fact that the Input Operands in the extended attribute can take method calls as proper inputs Example: [parameter] "r" (method(2)) This will likely require some patching in the assembly declaration Clobbers - String Literal containing clobbered registers, in the same syntax as existing extended asm, but each string literal is separated by spaces rather than commas Labels - List of Goto Labels, in the same syntax as existing extended asm Attributes - List of tokens indicating certain attributes this asm declaration should have, these are: singleton: The asm declaration is only emitted once in the method body that it is in, subsequent appearances of any asm declarations with the singleton directive specified are discarded count "asm name": The asm declaration is only emitted once in the method body that it is in, subsequent appearances of any asm declarations with the count directive will simply update %[asm name] in the string literal template of the very first instance to the number of times the asm declaration has appeared in the method, including the first time it has appeared stack: Forces appearances of %= within the asm declaration to have stack semantics, that is, references to labels with %= will refer to the innermost declaration, and each subsequent reference to such labels will refer to the previous declaration before the innermost declaration, and so on.This is particularly useful for using labels defined across multiple asm declarations volatile: Functions the same as extended asm declared as asm volatile (""); patch: For input operands, the patch directive causes the operand code to be patched into the asm declaration directly above the line of asm code that uses the operand, rather than before the asm declaration itself, as is done for existing extended asm These are the list of features available for this new proposed attribute, thoughts? best regards, Julian --000000000000e78bc4060a281932--