aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Sparc
diff options
context:
space:
mode:
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-10-05 02:29:47 +0000
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-10-05 02:29:47 +0000
commita8147756d681f100e58e88aae842aebf4f51693d (patch)
tree9a7c9c0c8bac4fcd34f2827a3512cec774c6526a /lib/Target/Sparc
parentb64c573649d53bdd89699de9bc57ba48f9dd2f1b (diff)
downloadexternal_llvm-a8147756d681f100e58e88aae842aebf4f51693d.zip
external_llvm-a8147756d681f100e58e88aae842aebf4f51693d.tar.gz
external_llvm-a8147756d681f100e58e88aae842aebf4f51693d.tar.bz2
[Sparc] Use correct alignment while loading/storing fp128 values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc')
-rw-r--r--lib/Target/Sparc/SparcISelLowering.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp
index 32e0269..22662c0 100644
--- a/lib/Target/Sparc/SparcISelLowering.cpp
+++ b/lib/Target/Sparc/SparcISelLowering.cpp
@@ -2298,12 +2298,16 @@ static SDValue LowerF128Load(SDValue Op, SelectionDAG &DAG)
assert(LdNode && LdNode->getOffset().getOpcode() == ISD::UNDEF
&& "Unexpected node type");
+ unsigned alignment = LdNode->getAlignment();
+ if (alignment > 8)
+ alignment = 8;
+
SDValue Hi64 = DAG.getLoad(MVT::f64,
dl,
LdNode->getChain(),
LdNode->getBasePtr(),
LdNode->getPointerInfo(),
- false, false, false, 8);
+ false, false, false, alignment);
EVT addrVT = LdNode->getBasePtr().getValueType();
SDValue LoPtr = DAG.getNode(ISD::ADD, dl, addrVT,
LdNode->getBasePtr(),
@@ -2313,7 +2317,7 @@ static SDValue LowerF128Load(SDValue Op, SelectionDAG &DAG)
LdNode->getChain(),
LoPtr,
LdNode->getPointerInfo(),
- false, false, false, 8);
+ false, false, false, alignment);
SDValue SubRegEven = DAG.getTargetConstant(SP::sub_even64, MVT::i32);
SDValue SubRegOdd = DAG.getTargetConstant(SP::sub_odd64, MVT::i32);
@@ -2357,13 +2361,18 @@ static SDValue LowerF128Store(SDValue Op, SelectionDAG &DAG) {
MVT::f64,
StNode->getValue(),
SubRegOdd);
+
+ unsigned alignment = StNode->getAlignment();
+ if (alignment > 8)
+ alignment = 8;
+
SDValue OutChains[2];
OutChains[0] = DAG.getStore(StNode->getChain(),
dl,
SDValue(Hi64, 0),
StNode->getBasePtr(),
MachinePointerInfo(),
- false, false, 8);
+ false, false, alignment);
EVT addrVT = StNode->getBasePtr().getValueType();
SDValue LoPtr = DAG.getNode(ISD::ADD, dl, addrVT,
StNode->getBasePtr(),
@@ -2373,7 +2382,7 @@ static SDValue LowerF128Store(SDValue Op, SelectionDAG &DAG) {
SDValue(Lo64, 0),
LoPtr,
MachinePointerInfo(),
- false, false, 8);
+ false, false, alignment);
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
&OutChains[0], 2);
}