Quick compiler (arm64) Fix inline Math.round()
Math.round is detected and inlined for arm64. However, the
arm64 backend incorrectly modified a source operand in place
during the round sequence. Depending on how registers are
allocated, that modification could persist. Changed to use a
temp register for the intermediate result.
Internal b/17411468
Change-Id: I7c636f985e193f8ff838768fde3b741e443bb1bb
diff --git a/test/083-compiler-regressions/src/Main.java b/test/083-compiler-regressions/src/Main.java
index c089c52..8d7bf01 100644
--- a/test/083-compiler-regressions/src/Main.java
+++ b/test/083-compiler-regressions/src/Main.java
@@ -30,6 +30,7 @@
}
public static void main(String args[]) throws Exception {
+ b17411468();
b2296099Test();
b2302318Test();
b2487514Test();
@@ -61,6 +62,17 @@
minDoubleWith3ConstsTest();
}
+ public static void b17411468() {
+ // b/17411468 - inline Math.round failure.
+ double d1 = 1.0;
+ double d2 = Math.round(d1);
+ if (d1 == d2) {
+ System.out.println("b17411468 passes");
+ } else {
+ System.out.println("b17411468 fails: Math.round(" + d1 + ") returned " + d2);
+ }
+ }
+
public static double minDouble(double a, double b, double c) {
return Math.min(Math.min(a, b), c);
}