From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21481 invoked by alias); 7 Aug 2014 08:47:38 -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 21430 invoked by uid 48); 7 Aug 2014 08:47:30 -0000 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug go/60406] recover.go: test13reflect2 test failure Date: Thu, 07 Aug 2014 08:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: go X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ian at airs dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-08/txt/msg00439.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60406 --- Comment #3 from Uro=C5=A1 Bizjak --- It looks that a hack, mentioned in Comment #0 should use asm goto instead of goto. The following test: --cut here-- extern void foo (void *); int test_bad (int p1, int p2) { __label__ bla1; foo (&&bla1); goto bla1; bla1: return 0; } int test_good (int p1, int p2) { __label__ bla2; foo (&&bla2); asm goto ("" :::: bla2); bla2: return 0; } --cut here-- results in (-O2): test_good: subl $28, %esp movl $.L5, (%esp) call foo .L6: .L5: xorl %eax, %eax addl $28, %esp ret which is much better than: test_bad: .L2: subl $28, %esp movl $.L2, (%esp) call foo xorl %eax, %eax addl $28, %esp ret Also checked on alpha: test_good: .frame $30,16,$26,0 .mask 0x4000000,-16 $LFB1: .cfi_startproc ldah $29,0($27) !gpdisp!4 lda $29,0($29) !gpdisp!4 $test_good..ng: lda $30,-16($30) .cfi_def_cfa_offset 16 cpys $f31,$f31,$f31 ldah $16,$L4($29) !gprelhigh ldq $27,foo($29) !literal!5 stq $26,0($30) .cfi_offset 26, -16 .prologue 1 lda $16,$L4($16) !gprellow jsr $26,($27),foo !lituse_jsr!5 ldah $29,0($26) !gpdisp!6 lda $29,0($29) !gpdisp!6 .align 3 #realign $L5: $L4: mov $31,$0 ldq $26,0($30) lda $30,16($30) .cfi_restore 26 .cfi_def_cfa_offset 0 ret $31,($26),1 Please note, that the check will still need some tolerance due to various l= abel alignment requirements, additional instructions, etc: 5c: 00 00 10 22 lda a0,0(a0) 5c: GPRELLOW .text+0x70 <- label loc 60: 00 40 5b 6b jsr ra,(t12),64 60: LITUSE .text+0x3 60: HINT foo 64: 00 00 ba 27 ldah gp,0(ra) <- retaddr 64: GPDISP .text+0x4 68: 00 00 bd 23 lda gp,0(gp) 6c: 00 00 fe 2f unop 70: 00 04 ff 47 clr v0 >>From gcc-bugs-return-457943-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 07 09:18:23 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 23577 invoked by alias); 7 Aug 2014 09:18:22 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 23533 invoked by uid 48); 7 Aug 2014 09:18:16 -0000 From: "finis at in dot tum.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/62011] False Data Dependency in popcnt instruction Date: Thu, 07 Aug 2014 09:18:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: finis at in dot tum.de X-Bugzilla-Status: UNCONFIRMED 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: cc Message-ID: In-Reply-To: References: 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: 2014-08/txt/msg00440.txt.bz2 Content-length: 782 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62011 finis at in dot tum.de changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |finis at in dot tum.de --- Comment #4 from finis at in dot tum.de --- > Not sure if we want to > disable popcnt use completely. No matter how to fix this, do not disable popcnt! Even with the false dependency it is still the fastest instruction for popcounting. The false dependency makes it slower, but it is still faster than a hand written version. The easiest fix IMHO would be using xor %r %r on the output register. It seems to work extremely well, as you can see in the answer of the linked SO question.