From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79216 invoked by alias); 2 Dec 2016 11:13:49 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 79191 invoked by uid 89); 2 Dec 2016 11:13:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=gabriel, Gabriel, H*r:4.80, H*f:sk:1B989D8 X-HELO: torres.puc.rediris.es Received: from torres.puc.rediris.es (HELO torres.puc.rediris.es) (130.206.18.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Dec 2016 11:13:36 +0000 Received: from [150.214.244.11] (helo=gra-lx1.iram.es) by torres.puc.rediris.es with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1cClmS-0001Cd-Pd; Fri, 02 Dec 2016 12:13:31 +0100 Received: by gra-lx1.iram.es (Postfix, from userid 1210) id 808CC18012AD; Fri, 2 Dec 2016 12:13:24 +0100 (CET) X-Envelope-From: paubert@iram.es Date: Fri, 02 Dec 2016 11:13:00 -0000 From: Gabriel Paubert To: Bin Fan at Work Cc: Szabolcs Nagy , "gcc@gcc.gnu.org" , nd@arm.com Subject: Re: GCC libatomic ABI specification draft Message-ID: <20161202111324.GA20797@visitor2.iram.es> References: <8764e547-1dd2-3ebd-2723-6568b4b54092@oracle.com> <1470412312.14544.4.camel@localhost.localdomain> <4a182edd-41a8-4ad9-444a-bf0af567ae98@oracle.com> <8317ec9d-41ad-d806-9144-eac2984cdd38@oracle.com> <583D627E.60103@arm.com> <1B989D8B-7AFE-401E-90FD-A683AC9E81EB@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1B989D8B-7AFE-401E-90FD-A683AC9E81EB@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spamina-Bogosity: Unsure X-Spamina-Spam-Score: -0.2 (/) X-Spamina-Spam-Report: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: arm.com] 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4398] X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00003.txt.bz2 On Thu, Dec 01, 2016 at 11:13:37AM -0800, Bin Fan at Work wrote: > Hi Szabolcs, > > > On Nov 29, 2016, at 3:11 AM, Szabolcs Nagy wrote: > > > > On 17/11/16 20:12, Bin Fan wrote: > >> > >> Although this ABI specification specifies that 16-byte properly aligned atomics are inlineable on platforms > >> supporting cmpxchg16b, we document the caveats here for further discussion. If we decide to change the > >> inlineable attribute for those atomics, then this ABI, the compiler and the runtime implementation should be > >> updated together at the same time. > >> > >> > >> The compiler and runtime need to check the availability of cmpxchg16b to implement this ABI specification. > >> Here is how it would work: The compiler can get the information either from the compiler flags or by > >> inquiring the hardware capabilities. When the information is not available, the compiler should assume that > >> cmpxchg16b instruction is not supported. The runtime library implementation can also query the hardware > >> compatibility and choose the implementation at runtime. Assuming the user provides correct compiler options > > > > with this abi the runtime implementation *must* query the hardware > > (because there might be inlined cmpxchg16b in use in another module > > on a hardware that supports it and the runtime must be able to sync > > with it). > > Thanks for the comment. Yes, the ABI requires libatomic must query the hardware. This is > necessary if we want the compiler to generate inlined code for 16-byte atomics. Note that > this particular issue only affects x86. Why? Power (at least recent ones) has 128 bit atomic instructions (lqarx/stqcx.) and Z has 128 bit compare and swap. Gabriel