summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler/utils/x86/assembler_x86.cc2
-rw-r--r--compiler/utils/x86_64/assembler_x86_64.cc2
-rw-r--r--test/407-arrays/src/Main.java15
3 files changed, 17 insertions, 2 deletions
diff --git a/compiler/utils/x86/assembler_x86.cc b/compiler/utils/x86/assembler_x86.cc
index a2cbd8b..4c7c4e9 100644
--- a/compiler/utils/x86/assembler_x86.cc
+++ b/compiler/utils/x86/assembler_x86.cc
@@ -248,7 +248,7 @@ void X86Assembler::movw(const Address& dst, const Immediate& imm) {
EmitOperandSizeOverride();
EmitUint8(0xC7);
EmitOperand(0, dst);
- CHECK(imm.is_int16());
+ CHECK(imm.is_uint16() || imm.is_int16());
EmitUint8(imm.value() & 0xFF);
EmitUint8(imm.value() >> 8);
}
diff --git a/compiler/utils/x86_64/assembler_x86_64.cc b/compiler/utils/x86_64/assembler_x86_64.cc
index ade7a13..17339ae 100644
--- a/compiler/utils/x86_64/assembler_x86_64.cc
+++ b/compiler/utils/x86_64/assembler_x86_64.cc
@@ -298,7 +298,7 @@ void X86_64Assembler::movw(const Address& dst, const Immediate& imm) {
EmitOptionalRex32(dst);
EmitUint8(0xC7);
EmitOperand(Register::RAX, dst);
- CHECK(imm.is_int16());
+ CHECK(imm.is_uint16() || imm.is_int16());
EmitUint8(imm.value() & 0xFF);
EmitUint8(imm.value() >> 8);
}
diff --git a/test/407-arrays/src/Main.java b/test/407-arrays/src/Main.java
index b5e95b0..d5c5604 100644
--- a/test/407-arrays/src/Main.java
+++ b/test/407-arrays/src/Main.java
@@ -70,6 +70,15 @@ public class Main extends TestCase {
chars[index] = 'd';
assertEquals('d', chars[index]);
+ chars[0] = 65535;
+ assertEquals(65535, chars[0]);
+ // Do an update between the two max value updates, to avoid
+ // optimizing the second away.
+ chars[index] = 0;
+ assertEquals(0, chars[index]);
+ chars[index] = 65535;
+ assertEquals(65535, chars[index]);
+
shorts[0] = -42;
assertEquals(-42, shorts[0]);
shorts[index] = -84;
@@ -86,7 +95,13 @@ public class Main extends TestCase {
Object o2 = new Object();
objects[index] = o2;
assertEquals(o2, objects[index]);
+ // Longs are initially not supported in the linear scan register allocator
+ // on 32bits. So we call out a long helper to ensure this method gets
+ // optimized.
+ $opt$testLongWrites(longs, index);
+ }
+ public static void $opt$testLongWrites(long[] longs, int index) {
long l = -21876876876876876L;
longs[0] = l;
assertEquals(l, longs[0]);