diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-08-06 00:24:09 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-08-06 00:25:37 +0100 |
commit | 30687af6830f1d09aa510d864557528038b33284 (patch) | |
tree | 44bc19391b1726f660d9b69d54231fc1d92ad73c /compiler/utils | |
parent | ae5092fcaf2175df9f8c7cf7f5542b31e829ac72 (diff) | |
download | art-30687af6830f1d09aa510d864557528038b33284.zip art-30687af6830f1d09aa510d864557528038b33284.tar.gz art-30687af6830f1d09aa510d864557528038b33284.tar.bz2 |
Fix SIB for base + index addressing in x86_64 assembler.
Change-Id: Ib630bc28e6d694ffbe4a4a71cc988e36d00f6633
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/x86_64/assembler_x86_64.h | 4 | ||||
-rw-r--r-- | compiler/utils/x86_64/assembler_x86_64_test.cc | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/compiler/utils/x86_64/assembler_x86_64.h b/compiler/utils/x86_64/assembler_x86_64.h index 1d6655c..2f814df 100644 --- a/compiler/utils/x86_64/assembler_x86_64.h +++ b/compiler/utils/x86_64/assembler_x86_64.h @@ -124,8 +124,8 @@ class Operand { if (index.NeedsRex()) { rex_ |= 0x42; // REX.00X0 } - encoding_[1] = (scale << 6) | (static_cast<uint8_t>(index.AsRegister()) << 3) | - static_cast<uint8_t>(base.AsRegister()); + encoding_[1] = (scale << 6) | (static_cast<uint8_t>(index.LowBits()) << 3) | + static_cast<uint8_t>(base.LowBits()); length_ = 2; } diff --git a/compiler/utils/x86_64/assembler_x86_64_test.cc b/compiler/utils/x86_64/assembler_x86_64_test.cc index 1f4d727..4ed7b20 100644 --- a/compiler/utils/x86_64/assembler_x86_64_test.cc +++ b/compiler/utils/x86_64/assembler_x86_64_test.cc @@ -128,9 +128,18 @@ TEST_F(AssemblerX86_64Test, XorqImm) { TEST_F(AssemblerX86_64Test, Movl) { GetAssembler()->movl(x86_64::CpuRegister(x86_64::R8), x86_64::CpuRegister(x86_64::R11)); GetAssembler()->movl(x86_64::CpuRegister(x86_64::RAX), x86_64::CpuRegister(x86_64::R11)); + GetAssembler()->movl(x86_64::CpuRegister(x86_64::RAX), x86_64::Address( + x86_64::CpuRegister(x86_64::RDI), x86_64::CpuRegister(x86_64::RBX), x86_64::TIMES_4, 12)); + GetAssembler()->movl(x86_64::CpuRegister(x86_64::RAX), x86_64::Address( + x86_64::CpuRegister(x86_64::RDI), x86_64::CpuRegister(x86_64::R9), x86_64::TIMES_4, 12)); + GetAssembler()->movl(x86_64::CpuRegister(x86_64::R8), x86_64::Address( + x86_64::CpuRegister(x86_64::RDI), x86_64::CpuRegister(x86_64::R9), x86_64::TIMES_4, 12)); const char* expected = "movl %R11d, %R8d\n" - "movl %R11d, %EAX\n"; + "movl %R11d, %EAX\n" + "movl 0xc(%RDI,%RBX,4), %EAX\n" + "movl 0xc(%RDI,%R9,4), %EAX\n" + "movl 0xc(%RDI,%R9,4), %R8d\n"; DriverStr(expected, "movl"); } |