llvm/test
James Molloy ab4e0362c7 [Thumb-1] Synthesize TBB/TBH instructions to make use of compressed jump tables
The TBB and TBH instructions in Thumb-2 allow jump tables to be compressed into sequences of bytes or shorts respectively. These instructions do not exist in Thumb-1, however it is possible to synthesize them out of a sequence of other instructions.

It turns out this sequence is so short that it's almost never a lose for performance and is ALWAYS a significant win for code size.

TBB example:
Before: lsls r0, r0, #2    After: add  r0, pc
        adr  r1, .LJTI0_0         ldrb r0, [r0, #6]
        ldr  r0, [r0, r1]         lsls r0, r0, #1
        mov  pc, r0               add  pc, r0
  => No change in prologue code size or dynamic instruction count. Jump table shrunk by a factor of 4.

The only case that can increase dynamic instruction count is the TBH case:

Before: lsls r0, r4, #2    After: lsls r4, r4, #1
        adr  r1, .LJTI0_0         add  r4, pc
        ldr  r0, [r0, r1]         ldrh r4, [r4, #6]
        mov  pc, r0               lsls r4, r4, #1
                                  add  pc, r4
  => 1 more instruction in prologue. Jump table shrunk by a factor of 2.

So there is an argument that this should be disabled when optimizing for performance (and a TBH needs to be generated). I'm not so sure about that in practice, because on small cores with Thumb-1 performance is often tied to code size. But I'm willing to turn it off when optimizing for performance if people want (also note that TBHs are fairly rare in practice!)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284580 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 12:06:49 +00:00
..
Analysis [SCEV] More accurate calculation of max backedge count of some less-than loops 2016-10-18 10:10:53 +00:00
Assembler DebugInfo: change alignment type from uint64_t to uint32_t to save space. 2016-10-18 14:31:22 +00:00
Bindings
Bitcode
BugPoint Disable fatal errors in the Verifier instantiated by bugpoint's crash 2016-10-18 16:24:43 +00:00
CodeGen [Thumb-1] Synthesize TBB/TBH instructions to make use of compressed jump tables 2016-10-19 12:06:49 +00:00
DebugInfo Revert r284545 again as the regression in ppc still exists. There is bug in MBPI exposed by th patch. 2016-10-19 01:18:25 +00:00
Demangle
Examples
ExecutionEngine Handle relocations to thumb functions when dynamic linking COFF modules 2016-10-17 18:56:18 +00:00
Feature
FileCheck
Instrumentation [asan] Append line number to variable name if line is available and in the same file as the function. 2016-10-18 23:29:41 +00:00
Integer
JitListener
LibDriver
Linker
LTO LTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions(). 2016-10-12 20:12:19 +00:00
MC [mips][ias] Handle more complicated expressions for memory operands 2016-10-18 15:17:17 +00:00
Object One more additional error check for invalid Mach-O files for a 2016-10-18 20:24:12 +00:00
ObjectYAML
Other
SymbolRewriter
TableGen
ThinLTO/X86 [ThinLTO] Don't link module level assembly when importing 2016-10-12 18:39:29 +00:00
tools dwarfdump: -summarize-types: print a short summary (unqualified type name, hash, length) of type units rather than dumping contents 2016-10-18 21:09:48 +00:00
Transforms Update the section.ll to fix non-x86 failure. 2016-10-19 03:53:41 +00:00
Unit
Verifier
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg
lit.site.cfg.in
TestRunner.sh