public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/66235] New: [SH] Optimize tst reg,const movrt sequence
@ 2015-05-21  8:46 olegendo at gcc dot gnu.org
  2015-05-21  9:30 ` [Bug target/66235] " olegendo at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-05-21  8:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66235

            Bug ID: 66235
           Summary: [SH] Optimize tst reg,const movrt sequence
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
  Target Milestone: ---
            Target: sh*-*-*

The following example:

bool test_00 (unsigned int x)
{
  return (x & 0x1042A) != 0;
}

compiled with -O2 -m4:

        mov.l   .L3,r1
        tst     r1,r4
        mov     #-1,r1
        rts
        negc    r1,r0
.L4:
        .align 2
.L3:
        .long   0x1042A

On non-SH2A there is no movrt insn and a !T -> reg move is done via negc.  If
the preceeding tst insn uses a constant, the constant can be complemented to
avoid the negc and #-1 constant load:

        mov.l   .L3,r1
        tst     r1,r4
        rts
        movt    r0
.L4:
        .align 2
.L3:
        .long   0xFFFEFBD5

The tstsi_t splitter could be extended to look for a following movrt insn and
optimize it accordingly.

The downside of doing this is an increased constant pool size, if the original
(non-complemented) constant is used for something else.  Moreover, it is only
beneficial to do this if there are no other negc #-1 movrt insns which share
the #-1 constant.  On the other hand, sharing the #-1 constant increases the
life time of regs and thus increases reg pressure.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug target/66235] [SH] Optimize tst reg,const movrt sequence
  2015-05-21  8:46 [Bug target/66235] New: [SH] Optimize tst reg,const movrt sequence olegendo at gcc dot gnu.org
@ 2015-05-21  9:30 ` olegendo at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-05-21  9:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66235

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
This is actually a special case of PR 65250.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-21  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-21  8:46 [Bug target/66235] New: [SH] Optimize tst reg,const movrt sequence olegendo at gcc dot gnu.org
2015-05-21  9:30 ` [Bug target/66235] " olegendo at gcc dot gnu.org

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).