@@ -881,38 +881,50 @@ bool MipsFastISel::selectLogicalOp(const Instruction *I) {
881
881
}
882
882
883
883
bool MipsFastISel::selectLoad (const Instruction *I) {
884
+ const LoadInst *LI = cast<LoadInst>(I);
885
+
884
886
// Atomic loads need special handling.
885
- if (cast<LoadInst>(I) ->isAtomic ())
887
+ if (LI ->isAtomic ())
886
888
return false ;
887
889
888
890
// Verify we have a legal type before going any further.
889
891
MVT VT;
890
- if (!isLoadTypeLegal (I->getType (), VT))
892
+ if (!isLoadTypeLegal (LI->getType (), VT))
893
+ return false ;
894
+
895
+ // Underaligned loads need special handling.
896
+ if (LI->getAlign () < VT.getFixedSizeInBits () / 8 )
891
897
return false ;
892
898
893
899
// See if we can handle this address.
894
900
Address Addr;
895
- if (!computeAddress (I ->getOperand (0 ), Addr))
901
+ if (!computeAddress (LI ->getOperand (0 ), Addr))
896
902
return false ;
897
903
898
904
unsigned ResultReg;
899
905
if (!emitLoad (VT, ResultReg, Addr))
900
906
return false ;
901
- updateValueMap (I , ResultReg);
907
+ updateValueMap (LI , ResultReg);
902
908
return true ;
903
909
}
904
910
905
911
bool MipsFastISel::selectStore (const Instruction *I) {
906
- Value *Op0 = I->getOperand (0 );
912
+ const StoreInst *SI = cast<StoreInst>(I);
913
+
914
+ Value *Op0 = SI->getOperand (0 );
907
915
unsigned SrcReg = 0 ;
908
916
909
917
// Atomic stores need special handling.
910
- if (cast<StoreInst>(I) ->isAtomic ())
918
+ if (SI ->isAtomic ())
911
919
return false ;
912
920
913
921
// Verify we have a legal type before going any further.
914
922
MVT VT;
915
- if (!isLoadTypeLegal (I->getOperand (0 )->getType (), VT))
923
+ if (!isLoadTypeLegal (SI->getOperand (0 )->getType (), VT))
924
+ return false ;
925
+
926
+ // Underaligned stores need special handling.
927
+ if (SI->getAlign () < VT.getFixedSizeInBits () / 8 )
916
928
return false ;
917
929
918
930
// Get the value to be stored into a register.
@@ -922,7 +934,7 @@ bool MipsFastISel::selectStore(const Instruction *I) {
922
934
923
935
// See if we can handle this address.
924
936
Address Addr;
925
- if (!computeAddress (I ->getOperand (1 ), Addr))
937
+ if (!computeAddress (SI ->getOperand (1 ), Addr))
926
938
return false ;
927
939
928
940
if (!emitStore (VT, SrcReg, Addr))
0 commit comments