Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2576260pxj; Sun, 6 Jun 2021 06:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfjWqXrIjpTwTJApF0+pYz04oKSvaxMfR5+KLaZtvq6ieUiZ6fZq+AS4GbnL5uxiQ9D87J X-Received: by 2002:a05:6402:1d38:: with SMTP id dh24mr15561942edb.18.1622987532225; Sun, 06 Jun 2021 06:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622987532; cv=none; d=google.com; s=arc-20160816; b=qBaW7UMUX6PtL548cDEclMqYVjfuvyV4Y9o14SbltFjYrsVgESh22snkzIjNu00xIF qfEWw4tPmzJYogLAnxr6QB+e7sTr+ROXOw9ioTXiWGqBXZ642aHHNYJWK7uLYXIZvOB7 pKoL+uskCasevZYwxuW4Yjas8vA3F2SY3MFZLnswqqByUW6S1/u97N/qehGixczEKzz9 +2fu5wrXN74tovc1hat+OgjEku4u+pHF3fLURFktjMbDeDmXCsG2YN9U8s1rYy5vTMIE ycbXD6jzgBuWQzodiIz25eCx/af1nyx+drP4jAohVRFa+YigG0h5ukRzw0Sjg/R10aAt vKaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=FuVbU7GkbEN3NERc0hv//67wIlDDKtazzk6q3xwX4d4=; b=QmG6pdz5D9Ulp6XfiCu1h3fVFfeMdaeZt8l4vdFJ8tYXbvhPH4oLxikjGiOvxOj4gX lsvICdTbTfc5BbhZmu0RXYXVgd3Dgc6TWQO6g7jQuG2wCWwhOJGIb8xGftIlD32luZme 2DsVv5b1Iedwx1TyEFDRUZJUKMin70n9bQGxOezgq4YwHK9M1LcJX9scVbS1KH7axkQh 3D8FA8JIv4Z/vRoL6espHHueeQsHr1wFAsZwPNwq9VagJaq/7Gv/135tyJZ4JxgKHL7n sSMTEHN1ulG/68sP4Fsk95G0cqiyRiE5PGK20PotraZrybRDnmi4LmYTgGUVM2OvrEjx hK+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la12si10689836ejc.560.2021.06.06.06.51.48; Sun, 06 Jun 2021 06:52:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbhFFNtl (ORCPT + 99 others); Sun, 6 Jun 2021 09:49:41 -0400 Received: from netrider.rowland.org ([192.131.102.5]:35615 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S230050AbhFFNtk (ORCPT ); Sun, 6 Jun 2021 09:49:40 -0400 Received: (qmail 1736554 invoked by uid 1000); 6 Jun 2021 09:47:49 -0400 Date: Sun, 6 Jun 2021 09:47:49 -0400 From: Alan Stern To: Segher Boessenkool Cc: Linus Torvalds , "Paul E. McKenney" , Peter Zijlstra , Will Deacon , Andrea Parri , Boqun Feng , Nick Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Linux Kernel Mailing List , linux-toolchains@vger.kernel.org, linux-arch Subject: Re: [RFC] LKMM: Add volatile_if() Message-ID: <20210606134749.GB1736178@rowland.harvard.edu> References: <20210604205600.GB4397@paulmck-ThinkPad-P17-Gen-1> <20210604214010.GD4397@paulmck-ThinkPad-P17-Gen-1> <20210605145739.GB1712909@rowland.harvard.edu> <20210606001418.GH4397@paulmck-ThinkPad-P17-Gen-1> <20210606012903.GA1723421@rowland.harvard.edu> <20210606125955.GT18427@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210606125955.GT18427@gate.crashing.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 06, 2021 at 07:59:55AM -0500, Segher Boessenkool wrote: > On Sat, Jun 05, 2021 at 08:41:00PM -0700, Linus Torvalds wrote: > > On Sat, Jun 5, 2021 at 6:29 PM Alan Stern wrote: > > > Interesting. And changing one of the branches from barrier() to __asm__ > > > __volatile__("nop": : :"memory") also causes a branch to be emitted. So > > > even though the compiler doesn't "look inside" assembly code, it does > > > compare two pieces at least textually and apparently assumes if they are > > > identical then they do the same thing. > > > > That's actually a feature in some cases, ie the ability to do CSE on > > asm statements (ie the "always has the same output" optimization that > > the docs talk about). > > > > So gcc has always looked at the asm string for that reason, afaik. > > GCC does not pretend it can understand the asm. But it can see when > two asm statements are identical. How similar do two asm strings have to be before they are considered identical? For instance, do changes to the amount of leading or trailing whitespace matter? Or what about including an empty assembly statement in one but not the other? Alan