summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator_mips.cc
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2016-01-28 17:14:52 +0000
committerDavid Brazdil <dbrazdil@google.com>2016-01-28 17:36:45 +0000
commitcc0f31174fe573f25d5952f4d9adaf75220b5a23 (patch)
tree6a560b0f7c18547bb63f4ff29a38b7caf2e9d8ff /compiler/optimizing/code_generator_mips.cc
parent6f06fdb008d8f3d5fca09db5a22b6a2a23eced42 (diff)
ART: Add missing swaps to MIPS codegen
Change-Id: I0fb50280ddf43f817d991c15d3b6cdeb4635d6c2
Diffstat (limited to 'compiler/optimizing/code_generator_mips.cc')
-rw-r--r--compiler/optimizing/code_generator_mips.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc
index a4ccd94168..85ffd66ce8 100644
--- a/compiler/optimizing/code_generator_mips.cc
+++ b/compiler/optimizing/code_generator_mips.cc
@@ -614,6 +614,31 @@ void ParallelMoveResolverMIPS::EmitSwap(size_t index) {
Exchange(loc1.GetStackIndex(), loc2.GetStackIndex(), /* double_slot */ false);
} else if (loc1.IsDoubleStackSlot() && loc2.IsDoubleStackSlot()) {
Exchange(loc1.GetStackIndex(), loc2.GetStackIndex(), /* double_slot */ true);
+ } else if ((loc1.IsRegister() && loc2.IsStackSlot()) ||
+ (loc1.IsStackSlot() && loc2.IsRegister())) {
+ Register reg = loc1.IsRegister() ? loc1.AsRegister<Register>()
+ : loc2.AsRegister<Register>();
+ intptr_t offset = loc1.IsStackSlot() ? loc1.GetStackIndex()
+ : loc2.GetStackIndex();
+ __ Move(TMP, reg);
+ __ LoadFromOffset(kLoadWord, reg, SP, offset);
+ __ StoreToOffset(kStoreWord, TMP, SP, offset);
+ } else if ((loc1.IsRegisterPair() && loc2.IsDoubleStackSlot()) ||
+ (loc1.IsDoubleStackSlot() && loc2.IsRegisterPair())) {
+ Register reg_l = loc1.IsRegisterPair() ? loc1.AsRegisterPairLow<Register>()
+ : loc2.AsRegisterPairLow<Register>();
+ Register reg_h = loc1.IsRegisterPair() ? loc1.AsRegisterPairHigh<Register>()
+ : loc2.AsRegisterPairHigh<Register>();
+ intptr_t offset_l = loc1.IsDoubleStackSlot() ? loc1.GetStackIndex()
+ : loc2.GetStackIndex();
+ intptr_t offset_h = loc1.IsDoubleStackSlot() ? loc1.GetHighStackIndex(kMipsWordSize)
+ : loc2.GetHighStackIndex(kMipsWordSize);
+ __ Move(TMP, reg_l);
+ __ Move(AT, reg_h);
+ __ LoadFromOffset(kLoadWord, reg_l, SP, offset_l);
+ __ LoadFromOffset(kLoadWord, reg_h, SP, offset_h);
+ __ StoreToOffset(kStoreWord, TMP, SP, offset_l);
+ __ StoreToOffset(kStoreWord, AT, SP, offset_h);
} else {
LOG(FATAL) << "Swap between " << loc1 << " and " << loc2 << " is unsupported";
}