summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2014-10-23 18:07:44 +0100
committerRoland Levillain <rpl@google.com>2014-10-23 18:07:44 +0100
commit30ca3d847fe72cfa33e1b2473100ea2d8bea4517 (patch)
treea66582c2cb6026be2f59ba66ff437429b67bbe44 /test
parent46fdec13b6dcaf932aa9fb1338f32df01aa0d959 (diff)
downloadart-30ca3d847fe72cfa33e1b2473100ea2d8bea4517.tar.gz
art-30ca3d847fe72cfa33e1b2473100ea2d8bea4517.tar.bz2
art-30ca3d847fe72cfa33e1b2473100ea2d8bea4517.zip
Revert "Implement long negate instruction in the optimizing compiler."
This reverts commit 66ce173a40eff4392e9949ede169ccf3108be2db.
Diffstat (limited to 'test')
-rw-r--r--test/411-optimizing-arith/src/Main.java34
-rw-r--r--test/415-optimizing-arith-neg/expected.txt0
-rw-r--r--test/415-optimizing-arith-neg/info.txt1
-rw-r--r--test/415-optimizing-arith-neg/src/Main.java133
-rw-r--r--test/Android.run-test.mk1
5 files changed, 34 insertions, 135 deletions
diff --git a/test/411-optimizing-arith/src/Main.java b/test/411-optimizing-arith/src/Main.java
index a22c516ff4..4de2271ebd 100644
--- a/test/411-optimizing-arith/src/Main.java
+++ b/test/411-optimizing-arith/src/Main.java
@@ -74,6 +74,7 @@ public class Main {
public static void main(String[] args) {
mul();
+ neg();
}
public static void mul() {
@@ -163,6 +164,34 @@ public class Main {
expectEquals(Double.POSITIVE_INFINITY, $opt$Mul(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
}
+ public static void neg() {
+ expectEquals(-1, $opt$Neg(1));
+ expectEquals(1, $opt$Neg(-1));
+ expectEquals(0, $opt$Neg(0));
+ expectEquals(51, $opt$Neg(-51));
+ expectEquals(-51, $opt$Neg(51));
+ expectEquals(2147483647, $opt$Neg(-2147483647)); // (2^31 - 1)
+ expectEquals(-2147483647, $opt$Neg(2147483647)); // -(2^31 - 1)
+ // From the Java 7 SE Edition specification:
+ // http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.15.4
+ //
+ // For integer values, negation is the same as subtraction from
+ // zero. The Java programming language uses two's-complement
+ // representation for integers, and the range of two's-complement
+ // values is not symmetric, so negation of the maximum negative
+ // int or long results in that same maximum negative number.
+ // Overflow occurs in this case, but no exception is thrown.
+ // For all integer values x, -x equals (~x)+1.''
+ expectEquals(-2147483648, $opt$Neg(-2147483648)); // -(2^31)
+
+ $opt$InplaceNegOne(1);
+ }
+
+ public static void $opt$InplaceNegOne(int a) {
+ a = -a;
+ expectEquals(-1, a);
+ }
+
static int $opt$Mul(int a, int b) {
return a * b;
}
@@ -178,4 +207,9 @@ public class Main {
static double $opt$Mul(double a, double b) {
return a * b;
}
+
+ static int $opt$Neg(int a){
+ return -a;
+ }
+
}
diff --git a/test/415-optimizing-arith-neg/expected.txt b/test/415-optimizing-arith-neg/expected.txt
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/415-optimizing-arith-neg/expected.txt
+++ /dev/null
diff --git a/test/415-optimizing-arith-neg/info.txt b/test/415-optimizing-arith-neg/info.txt
deleted file mode 100644
index 8494aad938..0000000000
--- a/test/415-optimizing-arith-neg/info.txt
+++ /dev/null
@@ -1 +0,0 @@
-Tests for arithmetic negation operations.
diff --git a/test/415-optimizing-arith-neg/src/Main.java b/test/415-optimizing-arith-neg/src/Main.java
deleted file mode 100644
index 3b25c9da39..0000000000
--- a/test/415-optimizing-arith-neg/src/Main.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Note that $opt$ is a marker for the optimizing compiler to ensure
-// it does compile the method.
-public class Main {
-
- public static void expectEquals(int expected, int result) {
- if (expected != result) {
- throw new Error("Expected: " + expected + ", found: " + result);
- }
- }
-
- public static void expectEquals(long expected, long result) {
- if (expected != result) {
- throw new Error("Expected: " + expected + ", found: " + result);
- }
- }
-
- public static void expectEquals(float expected, float result) {
- if (expected != result) {
- throw new Error("Expected: " + expected + ", found: " + result);
- }
- }
-
- public static void expectEquals(double expected, double result) {
- if (expected != result) {
- throw new Error("Expected: " + expected + ", found: " + result);
- }
- }
-
- public static void expectApproxEquals(float a, float b, float maxDelta) {
- boolean aproxEquals = (a > b)
- ? ((a - b) < maxDelta)
- : ((b - a) < maxDelta);
- if (!aproxEquals) {
- throw new Error("Expected: " + a + ", found: " + b + ", with delta: " + maxDelta);
- }
- }
-
- public static void expectApproxEquals(double a, double b, double maxDelta) {
- boolean aproxEquals = (a > b)
- ? ((a - b) < maxDelta)
- : ((b - a) < maxDelta);
- if (!aproxEquals) {
- throw new Error("Expected: " + a + ", found: " + b + ", with delta: " + maxDelta);
- }
- }
-
- public static void expectNaN(float a) {
- if (a == a) {
- throw new Error("Expected NaN: " + a);
- }
- }
-
- public static void expectNaN(double a) {
- if (a == a) {
- throw new Error("Expected NaN: " + a);
- }
- }
-
- public static void main(String[] args) {
- negInt();
- $opt$InplaceNegOneInt(1);
-
- negLong();
- $opt$InplaceNegOneLong(1L);
- }
-
- private static void negInt() {
- expectEquals(-1, $opt$NegInt(1));
- expectEquals(1, $opt$NegInt(-1));
- expectEquals(0, $opt$NegInt(0));
- expectEquals(51, $opt$NegInt(-51));
- expectEquals(-51, $opt$NegInt(51));
- expectEquals(2147483647, $opt$NegInt(-2147483647)); // (2^31 - 1)
- expectEquals(-2147483647, $opt$NegInt(2147483647)); // -(2^31 - 1)
- // From the Java 7 SE Edition specification:
- // http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.15.4
- //
- // For integer values, negation is the same as subtraction from
- // zero. The Java programming language uses two's-complement
- // representation for integers, and the range of two's-complement
- // values is not symmetric, so negation of the maximum negative
- // int or long results in that same maximum negative number.
- // Overflow occurs in this case, but no exception is thrown.
- // For all integer values x, -x equals (~x)+1.''
- expectEquals(-2147483648, $opt$NegInt(-2147483648)); // -(2^31)
- }
-
- private static void $opt$InplaceNegOneInt(int a) {
- a = -a;
- expectEquals(-1, a);
- }
-
- private static void negLong() {
- expectEquals(-1L, $opt$NegLong(1L));
- expectEquals(1L, $opt$NegLong(-1L));
- expectEquals(0L, $opt$NegLong(0L));
- expectEquals(51L, $opt$NegLong(-51L));
- expectEquals(-51L, $opt$NegLong(51L));
- expectEquals(9223372036854775807L, $opt$NegLong(-9223372036854775807L)); // (2^63 - 1)
- expectEquals(-9223372036854775807L, $opt$NegLong(9223372036854775807L)); // -(2^63 - 1)
- // See comment in negInt().
- expectEquals(-9223372036854775808L, $opt$NegLong(-9223372036854775808L)); // -(2^63)
- }
-
- private static void $opt$InplaceNegOneLong(long a) {
- a = -a;
- expectEquals(-1L, a);
- }
-
- static int $opt$NegInt(int a){
- return -a;
- }
-
- static long $opt$NegLong(long a){
- return -a;
- }
-}
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 5b95beb96e..682282532b 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -317,7 +317,6 @@ TEST_ART_BROKEN_OPTIMIZING_ARM64_RUN_TESTS := \
412-new-array \
413-regalloc-regression \
414-optimizing-arith-sub \
- 415-optimizing-arith-neg \
700-LoadArgRegs \
800-smali