From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28212 invoked by alias); 20 Dec 2012 12:35:36 -0000 Received: (qmail 28172 invoked by uid 48); 20 Dec 2012 12:35:15 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/55752] New: __builtin_ia32_ldmxcsr / __builtin_ia32_stmxcsr are not scheduling barriers Date: Thu, 20 Dec 2012 12:35: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-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-12/txt/msg01959.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55752 Bug #: 55752 Summary: __builtin_ia32_ldmxcsr / __builtin_ia32_stmxcsr are not scheduling barriers Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: rguenth@gcc.gnu.org Target: x86_64-*-* float foo (float x, float f32) { unsigned int mxscr_stat; mxscr_stat = __builtin_ia32_stmxcsr (); __builtin_ia32_ldmxcsr (mxscr_stat | 0x00000800); f32 = (x + f32) - f32; mxscr_stat = mxscr_stat & 0xffffffc0; __builtin_ia32_ldmxcsr (mxscr_stat); return f32; } Compiled at O2 yields: foo: .LFB0: .cfi_startproc stmxcsr -4(%rsp) movl -4(%rsp), %eax movl %eax, %edx orb $8, %dh movl %edx, -4(%rsp) ldmxcsr -4(%rsp) addss %xmm1, %xmm0 andl $-64, %eax movl %eax, -4(%rsp) ldmxcsr -4(%rsp) subss %xmm1, %xmm0 ret note how the subss is scheduled after the ldmxcsr call. It's ok (by pure luck of course) at the GIMPLE level.