summaryrefslogtreecommitdiffstats
path: root/test/411-optimizing-arith
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2014-10-23 16:38:33 +0100
committerRoland Levillain <rpl@google.com>2014-10-23 17:08:48 +0100
commit66ce173a40eff4392e9949ede169ccf3108be2db (patch)
tree552bc6275388c3bc6ecd4f549ffcd1422c020f82 /test/411-optimizing-arith
parente2b2cbf8bffdf9ee3ece487fde9ac78652b4abaf (diff)
downloadart-66ce173a40eff4392e9949ede169ccf3108be2db.zip
art-66ce173a40eff4392e9949ede169ccf3108be2db.tar.gz
art-66ce173a40eff4392e9949ede169ccf3108be2db.tar.bz2
Implement long negate instruction in the optimizing compiler.
- Add support for the neg-long (long integer two's complement negate) instruction in the optimizing compiler. - Add a 64-bit NEG instruction (negq) to the x86-64 assembler. - Generate ARM, x86 and x86-64 code for integer HNeg nodes. - Put neg-related tests into test/415-optimizing-arith-neg. Change-Id: I1fbe9611e134408a6b8745d1df20ab6ffa5e50f2
Diffstat (limited to 'test/411-optimizing-arith')
-rw-r--r--test/411-optimizing-arith/src/Main.java34
1 files changed, 0 insertions, 34 deletions
diff --git a/test/411-optimizing-arith/src/Main.java b/test/411-optimizing-arith/src/Main.java
index 4de2271..a22c516 100644
--- a/test/411-optimizing-arith/src/Main.java
+++ b/test/411-optimizing-arith/src/Main.java
@@ -74,7 +74,6 @@ public class Main {
public static void main(String[] args) {
mul();
- neg();
}
public static void mul() {
@@ -164,34 +163,6 @@ 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;
}
@@ -207,9 +178,4 @@ public class Main {
static double $opt$Mul(double a, double b) {
return a * b;
}
-
- static int $opt$Neg(int a){
- return -a;
- }
-
}