summaryrefslogtreecommitdiffstats
path: root/compiler/utils/x86_64
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-01-05 09:16:00 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-05 09:16:01 +0000
commit8558375377946aabbbda6ab584e13f754590bd89 (patch)
tree589087305c44e6378fa7a38838d7be48ab591506 /compiler/utils/x86_64
parent43a725cde37740f0384f3f73227c54249ba4fe4f (diff)
parent784cc5c37f382838f89e281758040c6620ccfd01 (diff)
downloadart-8558375377946aabbbda6ab584e13f754590bd89.zip
art-8558375377946aabbbda6ab584e13f754590bd89.tar.gz
art-8558375377946aabbbda6ab584e13f754590bd89.tar.bz2
Merge "Fix braino in x64 assembler."
Diffstat (limited to 'compiler/utils/x86_64')
-rw-r--r--compiler/utils/x86_64/assembler_x86_64.h4
-rw-r--r--compiler/utils/x86_64/assembler_x86_64_test.cc8
2 files changed, 9 insertions, 3 deletions
diff --git a/compiler/utils/x86_64/assembler_x86_64.h b/compiler/utils/x86_64/assembler_x86_64.h
index 51d1de2..abf2561 100644
--- a/compiler/utils/x86_64/assembler_x86_64.h
+++ b/compiler/utils/x86_64/assembler_x86_64.h
@@ -178,7 +178,7 @@ class Address : public Operand {
}
void Init(CpuRegister base_in, int32_t disp) {
- if (disp == 0 && base_in.AsRegister() != RBP) {
+ if (disp == 0 && base_in.LowBits() != RBP) {
SetModRM(0, base_in);
if (base_in.AsRegister() == RSP) {
SetSIB(TIMES_1, CpuRegister(RSP), base_in);
@@ -208,7 +208,7 @@ class Address : public Operand {
Address(CpuRegister base_in, CpuRegister index_in, ScaleFactor scale_in, int32_t disp) {
CHECK_NE(index_in.AsRegister(), RSP); // Illegal addressing mode.
- if (disp == 0 && base_in.AsRegister() != RBP) {
+ if (disp == 0 && base_in.LowBits() != RBP) {
SetModRM(0, CpuRegister(RSP));
SetSIB(scale_in, index_in, base_in);
} else if (disp >= -128 && disp <= 127) {
diff --git a/compiler/utils/x86_64/assembler_x86_64_test.cc b/compiler/utils/x86_64/assembler_x86_64_test.cc
index c8e923c..b8d724d 100644
--- a/compiler/utils/x86_64/assembler_x86_64_test.cc
+++ b/compiler/utils/x86_64/assembler_x86_64_test.cc
@@ -536,10 +536,16 @@ TEST_F(AssemblerX86_64Test, Movl) {
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));
+ GetAssembler()->movl(x86_64::CpuRegister(x86_64::RAX), x86_64::Address(
+ x86_64::CpuRegister(x86_64::R13), 0));
+ GetAssembler()->movl(x86_64::CpuRegister(x86_64::RAX), x86_64::Address(
+ x86_64::CpuRegister(x86_64::R13), x86_64::CpuRegister(x86_64::R9), x86_64::TIMES_1, 0));
const char* expected =
"movl 0xc(%RDI,%RBX,4), %EAX\n"
"movl 0xc(%RDI,%R9,4), %EAX\n"
- "movl 0xc(%RDI,%R9,4), %R8d\n";
+ "movl 0xc(%RDI,%R9,4), %R8d\n"
+ "movl (%R13), %EAX\n"
+ "movl (%R13,%R9,1), %EAX\n";
DriverStr(expected, "movl");
}