From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14213 invoked by alias); 19 Aug 2015 17:22:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 14181 invoked by uid 48); 19 Aug 2015 17:22:03 -0000 From: "tuliom at linux dot vnet.ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67281] New: HTM builtins aren't treated as compiler barriers on powerpc Date: Wed, 19 Aug 2015 17:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tuliom at linux dot vnet.ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-08/txt/msg01354.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67281 Bug ID: 67281 Summary: HTM builtins aren't treated as compiler barriers on powerpc Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tuliom at linux dot vnet.ibm.com Target Milestone: --- Depending on the level of optimization, GCC moves a memory access outside a transaction which breaks the atomicity of the transaction. This is a small testcase that reproduces this behavior: $ cat tbegin-barrier.c long foo (long dest, long src0, long src1, long tries) { long i; for (i = 0; i < tries; i++) { __builtin_tbegin (0); dest = src0 + src1; __builtin_tend (0); } return dest; } compiling using: -O2 -S -mcpu=power8 tbegin-barrier.c gives foo: cmpdi 0,6,0 blelr 0 mtctr 6 add 3,4,5 .p2align 4,,15 .L3: tbegin. 0 tend. 0 bdnz .L3 blr