From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29575 invoked by alias); 12 Jun 2013 08:15:42 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 29566 invoked by uid 89); 12 Jun 2013 08:15:42 -0000 X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from nm42-vm9.bullet.mail.gq1.yahoo.com (HELO nm42-vm9.bullet.mail.gq1.yahoo.com) (67.195.87.150) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 12 Jun 2013 08:15:41 +0000 Received: from [98.137.12.55] by nm42.bullet.mail.gq1.yahoo.com with NNFMP; 12 Jun 2013 08:15:39 -0000 Received: from [98.136.185.41] by tm15.bullet.mail.gq1.yahoo.com with NNFMP; 12 Jun 2013 08:15:39 -0000 Received: from [127.0.0.1] by smtp102.mail.gq1.yahoo.com with NNFMP; 12 Jun 2013 08:11:24 -0000 X-Yahoo-SMTP: fQw2HLOswBAfNNAqnKVM7sze51rEPzp2JLIy X-Rocket-Received: from [192.168.1.45] (limegreensocks@207.118.20.56 with ) by smtp102.mail.gq1.yahoo.com with SMTP; 12 Jun 2013 08:11:24 +0000 UTC Message-ID: <51B82E29.5000405@yahoo.com> Date: Wed, 12 Jun 2013 08:15:00 -0000 From: dw User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Ian Lance Taylor CC: "gcc-help@gcc.gnu.org" Subject: Re: Question about __builtin_ia32_mfence and memory barriers References: <51AE7119.5090000@yahoo.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-06/txt/msg00077.txt.bz2 >> 1) Am I right that __builtin_ia32_mfence() does not generate a memory >> barrier? > That is correct: it does not prevent the compiler from moving loads > and stores across the call to __builtin_ia32_mfence. Are you sure? Based on your comment, I was fully expecting to be able to produce a failure case suitable for bugzilla. In fact, I *can* generate failure cases if I comment the __builtin_ia32_mfence() call out of _mm_mfence and replace it with something else (like asm("mfence")). But as soon as I put the __builtin_ia32_mfence call back in, my "failure scenario" clears right up. In short, it looks like __builtin_ia32_mfence *does* generate a barrier. But so do other builtins (like __builtin_ia32_pause). Does that even seem possible? It would be weird if every builtin (or even every ia32 builtin) implied a barrier. dw