public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "oleg.endo@t-online.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/51697] New: SH Target: Inefficient DImode comparisons for -Os Date: Thu, 29 Dec 2011 00:35:00 -0000 [thread overview] Message-ID: <bug-51697-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51697 Bug #: 51697 Summary: SH Target: Inefficient DImode comparisons for -Os Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: oleg.endo@t-online.de CC: kkojima@gcc.gnu.org Target: sh*-*-* For -Os and everything but -m1 DImode comparisons are not optimized properly which results in redundant SImode comparisons, producing code worse than for -O1. A reduced example: int test_0 (long long* x) { return *x & 0xFFFFFFFF ? -20 : -40; } -Os -m2/-m3/-m4: mov #0,r2 ! 55 movsi_ie/3 [length = 2] tst r2,r2 ! 57 cmpeqsi_t/1 [length = 2] bf/s .L12 ! 58 branch_false [length = 2] mov.l @(4,r4),r3 ! 12 movsi_ie/7 [length = 2] tst r3,r3 ! 59 cmpeqsi_t/1 [length = 2] .L12: bt/s .L11 ! 14 branch_true [length = 2] mov #-40,r0 ! 5 movsi_ie/3 [length = 2] mov #-20,r0 ! 4 movsi_ie/3 [length = 2] .L11: rts nop ! 65 *return_i [length = 4] -Os -m1: -O2 -m4: mov.l @(4,r4),r1 ! 10 movsi_i/5 [length = 2] mov #-40,r0 ! 5 movsi_i/3 [length = 2] tst r1,r1 ! 15 cmpeqsi_t/1 [length = 2] bt .L7 ! 16 branch_true [length = 2] mov #-20,r0 ! 4 movsi_i/3 [length = 2] .L7: rts nop ! 61 *return_i [length = 4] -O1 -m4: mov.l @(4,r4),r1 ! 10 movsi_ie/7 [length = 2] tst r1,r1 ! 17 cmpeqsi_t/1 [length = 2] bt/s .L6 ! 18 branch_true [length = 2] mov #-40,r0 ! 5 movsi_ie/3 [length = 2] mov #-20,r0 ! 4 movsi_ie/3 [length = 2] .L6: rts nop ! 62 *return_i [length = 4] Another example would be: int test_2 (unsigned long long x) { return x >= 0x100000000LL ? -20 : -40; } -Os -m2/-m3/-m4: mov #0,r2 ! 48 movsi_ie/3 [length = 2] mov #-1,r3 ! 49 movsi_ie/3 [length = 2] cmp/eq r2,r4 ! 9 cmpgtudi_t [length = 8] bf/s .Ldi67 cmp/hi r2,r4 cmp/hi r3,r5 .Ldi67: bf/s .L16 ! 10 branch_false [length = 2] mov #-40,r0 ! 5 movsi_ie/3 [length = 2] mov #-20,r0 ! 4 movsi_ie/3 [length = 2] .L16: rts nop ! 52 *return_i [length = 4] -Os -m1: tst r4,r4 ! 9 cmpeqsi_t/1 [length = 2] mov #-20,r0 ! 4 movsi_i/3 [length = 2] bf .L12 ! 10 branch_false [length = 2] mov #-40,r0 ! 5 movsi_i/3 [length = 2] .L12: rts nop ! 56 *return_i [length = 4] The problem does not appear for -m1, only for -Os and -m2*, -m3*, -m4*.
next reply other threads:[~2011-12-29 0:22 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-29 0:35 oleg.endo@t-online.de [this message] 2012-04-12 6:57 ` [Bug target/51697] " olegendo at gcc dot gnu.org 2013-12-08 22:16 ` olegendo at gcc dot gnu.org 2013-12-08 22:22 ` olegendo at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-51697-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).