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/54272] [SH] Add support for addv / subv instructions Date: Thu, 19 Sep 2013 11:07:00 -0000 [thread overview] Message-ID: <bug-54272-4-WuesGQXFfK@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-54272-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54272 --- Comment #6 from Oleg Endo <olegendo at gcc dot gnu.org> --- Another example where addv could be used: int test (int a) { if (a == 0x7FFFFFFF) return a; return a + 1; } currently compiles to: -O2 -m2a: mov.l .L6,r1 cmp/eq r1,r4 bt.s .L4 mov r4,r0 add #1,r0 .L4: rts/n .align 2 .L6: .long 2147483647 -O2 -m4: mov.l .L4,r1 mov #-1,r0 cmp/eq r1,r4 negc r0,r0 rts add r4,r0 .align 2 .L4: .long 2147483647 better: SH4 with zero displacement branch: mov #1,r0 addv r4,r0 // T = r0 == 0x80000000 (overflow) bt 0f mov r4,r0 0: rts nop branch-free: mov #1,r0 mov #0,r1 addv r4,r0 // T = r0 == 0x80000000 (overflow) rts subc r1,r0 // r0 = r0 - r1 - T
next prev parent reply other threads:[~2013-09-19 11:07 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-08-15 16:03 [Bug target/54272] New: " olegendo at gcc dot gnu.org 2012-08-15 16:17 ` [Bug target/54272] " olegendo at gcc dot gnu.org 2012-08-16 11:24 ` kkojima at gcc dot gnu.org 2012-08-16 12:43 ` olegendo at gcc dot gnu.org 2012-08-16 13:00 ` kkojima at gcc dot gnu.org 2012-08-16 20:35 ` olegendo at gcc dot gnu.org 2013-09-19 11:07 ` olegendo at gcc dot gnu.org [this message] 2014-07-24 19:23 ` olegendo at gcc dot gnu.org 2014-11-16 2:26 ` 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-54272-4-WuesGQXFfK@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).