Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 8036216B0CB2 for ; Mon, 19 Dec 2011 17:54:02 -0400 (AST) Received: from mail-qw0-f53.google.com ([209.85.216.53]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rcl9j-0001Ho-4K for pgsql-bugs@postgresql.org; Mon, 19 Dec 2011 21:54:03 +0000 Received: by qadb15 with SMTP id b15so3617371qad.19 for ; Mon, 19 Dec 2011 13:53:46 -0800 (PST) Received: by 10.224.197.7 with SMTP id ei7mr2775005qab.84.1324331624843; Mon, 19 Dec 2011 13:53:44 -0800 (PST) Received: from tornado.leadboat.com (ip68-230-222-48.rd.hr.cox.net. [68.230.222.48]) by mx.google.com with ESMTPS id ih18sm38666835qab.8.2011.12.19.13.53.43 (version=SSLv3 cipher=OTHER); Mon, 19 Dec 2011 13:53:44 -0800 (PST) Date: Mon, 19 Dec 2011 16:53:41 -0500 From: Noah Misch To: Heikki Linnakangas Cc: Tom Lane , Robert Haas , PostgreSQL Bugs Subject: Re: Re: [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb] Message-ID: <20111219215341.GD9495@tornado.leadboat.com> References: <4EEB1C77.1000309@enterprisedb.com> <20111218224203.GA2950@piware.de> <4EEF5397.8090200@enterprisedb.com> <20111219200341.GB9495@tornado.leadboat.com> <14852.1324325578@sss.pgh.pa.us> <4EEFABB2.5050100@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EEFABB2.5050100@enterprisedb.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201112/165 X-Sequence-Number: 31976 On Mon, Dec 19, 2011 at 11:25:06PM +0200, Heikki Linnakangas wrote: > I compiled the attached test program on an HP Itanium box, using the > same flags you get from PostgreSQL's configure on that box. The relevant > assembler output is: > > xchg4 r14 = [r15], r14 // M [slocktest.c: 66/3] > //file/line/col slocktest.c/67/3 > ld1.acq r16 = [r11] // M [slocktest.c: 67/3] > nop.i 0 // I > //file/line/col slocktest.c/68/3 > st1.rel [r11] = r10 ;; // M [slocktest.c: 68/3] > //file/line/col slocktest.c/69/3 > st4.rel [r15] = r0 // M [slocktest.c: 69/3] > //file/line/col slocktest.c/70/1 > > > The trick I missed is that the compiler attaches .rel to all the stores > and .acq to all the loads through a volatile pointer. gcc seems to do > the same. So we're safe. The Intel compiler appears not to follow this convention: http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/cpp/lin/compiler_c/copts/ccpp_options/option_qserialize-volatile.htm If you have that compiler installed, could you see which opcode it generates? Thanks, nm