summaryrefslogtreecommitdiffstats
path: root/test/083-compiler-regressions
diff options
context:
space:
mode:
authorAlexei Zavjalov <alexei.zavjalov@intel.com>2014-02-26 10:38:23 +0700
committerAlexei Zavjalov <alexei.zavjalov@intel.com>2014-02-26 16:46:13 +0700
commitc17ebe866beb50eb6da1e6a47555cb4731467f3b (patch)
tree704a456285312482394cb15e02dbfaa23e386f0f /test/083-compiler-regressions
parentef2cc5a9c6e508a3e8b24d04ca35f7422f27e112 (diff)
downloadart-c17ebe866beb50eb6da1e6a47555cb4731467f3b.zip
art-c17ebe866beb50eb6da1e6a47555cb4731467f3b.tar.gz
art-c17ebe866beb50eb6da1e6a47555cb4731467f3b.tar.bz2
Incorrect result of the "mul-long by 1" operation
ART handles "mul-long by 1" as a special case and try to alloc a new pair of regs through the EvalLocWide method and then put there the multiplicand through the StoreValueWide method. But in case when both multiplicand and multiplier are constants, it will not place correct values in a new reg pair and result of calculations will be incorrect. The new solution uses the only StoreValueWide method. Change-Id: I3d6947737c92c5a12f2840003b17a427e31d288f Signed-off-by: Alexei Zavjalov <alexei.zavjalov@intel.com>
Diffstat (limited to 'test/083-compiler-regressions')
-rw-r--r--test/083-compiler-regressions/expected.txt1
-rw-r--r--test/083-compiler-regressions/src/Main.java14
2 files changed, 15 insertions, 0 deletions
diff --git a/test/083-compiler-regressions/expected.txt b/test/083-compiler-regressions/expected.txt
index 57065ef..541f0f8 100644
--- a/test/083-compiler-regressions/expected.txt
+++ b/test/083-compiler-regressions/expected.txt
@@ -4,6 +4,7 @@ b2487514 passes
b5884080 passes
largeFrame passes
largeFrameFloat passes
+mulBy1Test passes
getterSetterTest passes
identityTest passes
wideGetterSetterTest passes
diff --git a/test/083-compiler-regressions/src/Main.java b/test/083-compiler-regressions/src/Main.java
index 6829388..81f5b14 100644
--- a/test/083-compiler-regressions/src/Main.java
+++ b/test/083-compiler-regressions/src/Main.java
@@ -35,6 +35,7 @@ public class Main {
b5884080Test();
largeFrameTest();
largeFrameTestFloat();
+ mulBy1Test();
getterSetterTest();
identityTest();
wideGetterSetterTest();
@@ -161,6 +162,19 @@ public class Main {
}
}
+ static void mulBy1Test() {
+ long res;
+ long j = 1;
+ res = 1 * j + j;
+ if (res == 2L) {
+ System.out.println("mulBy1Test passes");
+ }
+ else {
+ System.out.println("mulBy1Test fails: " + res +
+ " (expecting 2)");
+ }
+ }
+
static void b2296099Test() throws Exception {
int x = -1190771042;
int dist = 360530809;