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

            Bug ID: 65069
           Summary: [SH] Calculate constants
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
            Target: sh*-*-*

If constants don't fit into K08 or I08 they are usually placed into the
constant pool and loaded using a PC-relative load.  Some constants however can
be calculated with 2..3 arithmetic insns.  This can be beneficial in some
cases:

- If the constant load is required only once, it can result in shorter code.  A
load of a full 32 bit constant is 2 + 4 = 6 bytes, which is 3 insns worth.  For
instance loading 0x00FFFFFF can be done by 'mov #-1,rn; shlr8 rn;'.

- On MCUs that don't separate memories/paths for instruction and data, memory
loads conflict with instruction fetches.  Thus 2 insns that don't access memory
might be faster than 1 mem load insn.

Reply via email to