Some enhancements for memcpy / memset inline expansion.
authorEvan Cheng <evan.cheng@apple.com>
Mon, 10 Dec 2012 23:21:26 +0000 (23:21 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 10 Dec 2012 23:21:26 +0000 (23:21 +0000)
commit79e2ca90bcfcc3310d5f724409f0bef193726743
tree3ecbf7e33e22074637dbe856ee55298fd4abeedf
parentedd62b14e5284182231ecb4eb3850205167c4076
Some enhancements for memcpy / memset inline expansion.
1. Teach it to use overlapping unaligned load / store to copy / set the trailing
   bytes. e.g. On 86, use two pairs of movups / movaps for 17 - 31 byte copies.
2. Use f64 for memcpy / memset on targets where i64 is not legal but f64 is. e.g.
   x86 and ARM.
3. When memcpy from a constant string, do *not* replace the load with a constant
   if it's not possible to materialize an integer immediate with a single
   instruction (required a new target hook: TLI.isIntImmLegal()).
4. Use unaligned load / stores more aggressively if target hooks indicates they
   are "fast".
5. Update ARM target hooks to use unaligned load / stores. e.g. vld1.8 / vst1.8.
   Also increase the threshold to something reasonable (8 for memset, 4 pairs
   for memcpy).

This significantly improves Dhrystone, up to 50% on ARM iOS devices.

rdar://12760078

llvm-svn: 169791
15 files changed:
llvm/include/llvm/Target/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMISelLowering.h
llvm/lib/Target/ARM/ARMInstrThumb2.td
llvm/lib/Target/Mips/MipsISelLowering.cpp
llvm/lib/Target/Mips/MipsISelLowering.h
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/test/CodeGen/ARM/2011-10-26-memset-with-neon.ll
llvm/test/CodeGen/ARM/memcpy-inline.ll
llvm/test/CodeGen/ARM/memset-inline.ll [new file with mode: 0644]
llvm/test/CodeGen/ARM/reg_asc_order.ll [deleted file]
llvm/test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll
llvm/test/CodeGen/X86/memcpy-2.ll