[mips] When double precision loads and stores are split into two i32 loads and
authorAkira Hatanaka <ahatanaka@mips.com>
Mon, 9 Sep 2013 17:59:32 +0000 (17:59 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Mon, 9 Sep 2013 17:59:32 +0000 (17:59 +0000)
stores, make sure the load or store that accesses the higher half does not have
an alignment that is larger than the offset from the original address.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190318 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsSEISelLowering.cpp

index f32e146368c3f3c87aaf3f06b6f906e6a8e527d9..2436e540f143aa7dc194cfbc7821065837be34de 100644 (file)
@@ -645,7 +645,7 @@ SDValue MipsSETargetLowering::lowerLOAD(SDValue Op, SelectionDAG &DAG) const {
   SDValue Hi = DAG.getLoad(MVT::i32, DL, Lo.getValue(1), Ptr,
                            MachinePointerInfo(), Nd.isVolatile(),
                            Nd.isNonTemporal(), Nd.isInvariant(),
-                           Nd.getAlignment());
+                           std::min(Nd.getAlignment(), 4U));
 
   if (!Subtarget->isLittle())
     std::swap(Lo, Hi);
@@ -681,8 +681,8 @@ SDValue MipsSETargetLowering::lowerSTORE(SDValue Op, SelectionDAG &DAG) const {
   // i32 store to higher address.
   Ptr = DAG.getNode(ISD::ADD, DL, PtrVT, Ptr, DAG.getConstant(4, PtrVT));
   return DAG.getStore(Chain, DL, Hi, Ptr, MachinePointerInfo(),
-                      Nd.isVolatile(), Nd.isNonTemporal(), Nd.getAlignment(),
-                      Nd.getTBAAInfo());
+                      Nd.isVolatile(), Nd.isNonTemporal(),
+                      std::min(Nd.getAlignment(), 4U), Nd.getTBAAInfo());
 }
 
 SDValue MipsSETargetLowering::lowerMulDiv(SDValue Op, unsigned NewOpc,