public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54685] New: [SH] Improve unsigned int comparison with 0x7FFFFFFF Date: Sun, 23 Sep 2012 19:34:00 -0000 [thread overview] Message-ID: <bug-54685-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54685 Bug #: 54685 Summary: [SH] Improve unsigned int comparison with 0x7FFFFFFF Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target AssignedTo: olegendo@gcc.gnu.org ReportedBy: olegendo@gcc.gnu.org Target: sh*-*-* The following cases: int test_00 (unsigned int a) { return !(a > 0x7FFFFFFF); } int test_01 (unsigned int a) { return a <= 0x7FFFFFFF; } int test_02 (unsigned int a) { return a < 0x80000000; } compile to (-m4 -O2): not r4,r0 shll r0 rts movt r0 which would be better as: cmp/pz r4 ! T = r4 >= 0 (signed) rts movt r0 For some reason, these do not go through the cstoresi4 expander, but the following does: int test (unsigned int a) { return a > 0; } The cstore is expanded by the middle-end into something like (insn 6 3 7 2 (set (reg:SI 167) (not:SI (reg/v:SI 164 [ a ]))) sh_tmp.cpp:1984 185 {one_cmplsi2} (nil)) (insn 7 6 8 2 (parallel [ (set (reg:SI 166 [ D.42391+-3 ]) (lshiftrt:SI (reg:SI 167) (const_int 31 [0x1f]))) (clobber (reg:SI 147 t)) ]) sh_tmp.cpp:1984 167 {lshrsi3_n_clobbers_t} (nil)) And combine then looks for: Failed to match this instruction: (parallel [ (set (reg:SI 166 [ D.42391+-3 ]) (ge:SI (reg:SI 4 r4 [ a ]) (const_int 0 [0]))) (clobber (reg:SI 147 t)) ])
next reply other threads:[~2012-09-23 19:34 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-23 19:34 olegendo at gcc dot gnu.org [this message] 2012-09-23 19:34 ` [Bug target/54685] " olegendo at gcc dot gnu.org 2012-10-04 23:50 ` olegendo at gcc dot gnu.org 2012-10-08 10:09 ` olegendo at gcc dot gnu.org 2012-10-08 18:36 ` [Bug middle-end/54685] " olegendo at gcc dot gnu.org 2012-11-06 20:25 ` olegendo at gcc dot gnu.org 2013-02-04 23:03 ` olegendo at gcc dot gnu.org 2013-02-05 0:09 ` kkojima at gcc dot gnu.org 2013-02-15 21:28 ` olegendo at gcc dot gnu.org 2013-02-15 21:34 ` olegendo at gcc dot gnu.org 2013-12-17 21:07 ` 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-54685-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).