diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-28 05:49:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-28 05:49:35 +0000 |
commit | 4002a1b6f1cb7c7db7965bd281fb29664fd6c816 (patch) | |
tree | 5a7bf8429810a521d763dda969ce626d9f382e3f /lib | |
parent | b3696d865e70c0153f82092d51999e5e55505427 (diff) | |
download | external_llvm-4002a1b6f1cb7c7db7965bd281fb29664fd6c816.zip external_llvm-4002a1b6f1cb7c7db7965bd281fb29664fd6c816.tar.gz external_llvm-4002a1b6f1cb7c7db7965bd281fb29664fd6c816.tar.bz2 |
Fix a nasty miscompilation of 176.gcc on linux/x86 where we synthesized
a memset using 16-byte XMM stores, but where the stack realignment code
didn't work. Until it does (PR2962) disable use of xmm regs in memcpy
and memset formation for linux and other targets with insufficiently
aligned stacks.
This is part of PR2888
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 3dbedba..a10f8a8 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -850,10 +850,15 @@ unsigned X86TargetLowering::getByValTypeAlignment(const Type *Ty) const { MVT X86TargetLowering::getOptimalMemOpType(uint64_t Size, unsigned Align, bool isSrcConst, bool isSrcStr) const { - if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16) - return MVT::v4i32; - if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16) - return MVT::v4f32; + // FIXME: This turns off use of xmm stores for memset/memcpy on targets like + // linux. This is because the stack realignment code can't handle certain + // cases like PR2962. This should be removed when PR2962 is fixed. + if (Subtarget->getStackAlignment() >= 16) { + if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16) + return MVT::v4i32; + if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16) + return MVT::v4f32; + } if (Subtarget->is64Bit() && Size >= 8) return MVT::i64; return MVT::i32; |