public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/31640]  New: cache align alignment is too aggressive on sh-elf
@ 2007-04-20  8:33 chrbr at gcc dot gnu dot org
  2007-04-20  8:57 ` [Bug target/31640] cache block " chrbr at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2007-04-20  8:33 UTC (permalink / raw)
  To: gcc-bugs

The sh4 port aligns blocks that have no fallthrus and that are either
frequently executed (JUMP_ALIGN) or preceeded a barrier
(LABEL_ALIGN_AFTER_BARRIER) on a cache line.

While in theory this help to avoid cache misses if the block slits over 2 cache
lines, in practise this reduces cache locality and lenghten distance between
blocks.
The number of issued instructions are also impacted. For example the relative
indirect address in jump tables needs a byte zero extend instruction if the
distance occupies 8 bits instead of 7 bits. 

I ran some experiments and benchmarked (eembc) with 2 strategies
1) -falign-jumps=1
2) Align the block if the size is bigger than a given threshold. (empirically
set to 16 bytes, half of the cache line size). See illustrating attached patch.

My conclusion is that in -O3 the performance never degrades (option 2 is a
little bit better, even improving dhrystone by 3%) when removing this padding.
And the text size improves by ~15%.

So I was not able to measurate the benefit of the cache line padding although
the code size impact is big (even in -O2/-O3 a code size bloat should be
motivated by some performance improvement).

Is there a motivating test that justifies this microoptimisation ?

In the illustrating patch I still align the basic blocks on 4-bytes to account
for better instruction fetch accesses


-- 
           Summary: cache align alignment is too aggressive on sh-elf
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chrbr at gcc dot gnu dot org
GCC target triplet: sh-superh-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31640


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

end of thread, other threads:[~2012-03-19 19:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-31640-4@http.gcc.gnu.org/bugzilla/>
2011-12-31 17:29 ` [Bug target/31640] cache block alignment is too aggressive on sh-elf oleg.endo@t-online.de
2012-02-26 23:33 ` olegendo at gcc dot gnu.org
2012-03-02 20:57 ` olegendo at gcc dot gnu.org
2012-03-19 19:36 ` olegendo at gcc dot gnu.org
2007-04-20  8:33 [Bug target/31640] New: cache align " chrbr at gcc dot gnu dot org
2007-04-20  8:57 ` [Bug target/31640] cache block " chrbr at gcc dot gnu dot org
2007-04-20 13:13 ` chrbr at gcc dot gnu dot org
2007-04-20 14:51 ` chrbr at gcc dot gnu dot 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).