summaryrefslogtreecommitdiff
path: root/dx/tests/054-dex-high16
diff options
context:
space:
mode:
Diffstat (limited to 'dx/tests/054-dex-high16')
-rw-r--r--dx/tests/054-dex-high16/Blort.java74
-rw-r--r--dx/tests/054-dex-high16/expected.txt68
-rw-r--r--dx/tests/054-dex-high16/info.txt6
-rw-r--r--dx/tests/054-dex-high16/run19
4 files changed, 167 insertions, 0 deletions
diff --git a/dx/tests/054-dex-high16/Blort.java b/dx/tests/054-dex-high16/Blort.java
new file mode 100644
index 0000000..9fba972
--- /dev/null
+++ b/dx/tests/054-dex-high16/Blort.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2007 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.
+ */
+
+public class Blort
+{
+ public static void sink(int i) {
+ // Do nothing.
+ }
+
+ public static void sink(long l) {
+ // Do nothing.
+ }
+
+ public static void sink(float f) {
+ // Do nothing.
+ }
+
+ public static void sink(double d) {
+ // Do nothing.
+ }
+
+ public static void testInt() {
+ sink(Integer.MIN_VALUE);
+ sink(0x40000000);
+ sink(0x20000000);
+ sink(0x10000000);
+ sink(0x00080000);
+ sink(0x00040000);
+ sink(0x00020000);
+ sink(0x00010000);
+ sink(0x56780000);
+ }
+
+ public static void testLong() {
+ sink(Long.MIN_VALUE);
+ sink(0x4000000000000000L);
+ sink(0x2000000000000000L);
+ sink(0x1000000000000000L);
+ sink(0x0008000000000000L);
+ sink(0x0004000000000000L);
+ sink(0x0002000000000000L);
+ sink(0x0001000000000000L);
+ sink(0x5678000000000000L);
+ }
+
+ public static void testFloat() {
+ sink(Float.NEGATIVE_INFINITY);
+ sink(-0.0f);
+ sink(1.0f);
+ sink(Float.POSITIVE_INFINITY);
+ sink(Float.NaN);
+ }
+
+ public static void testDouble() {
+ sink(Double.NEGATIVE_INFINITY);
+ sink(-0.0);
+ sink(1.0);
+ sink(Double.POSITIVE_INFINITY);
+ sink(Double.NaN);
+ }
+}
diff --git a/dx/tests/054-dex-high16/expected.txt b/dx/tests/054-dex-high16/expected.txt
new file mode 100644
index 0000000..b9d6cf3
--- /dev/null
+++ b/dx/tests/054-dex-high16/expected.txt
@@ -0,0 +1,68 @@
+Blort.testDouble:()V:
+regs: 0002; ins: 0000; outs: 0002
+ 0000: const-wide/high16 v0, #double -Infinity // #fff0000000000000
+ 0002: invoke-static {v0, v1}, Blort.sink:(D)V
+ 0005: const-wide/high16 v0, #double -0.0 // #8000000000000000
+ 0007: invoke-static {v0, v1}, Blort.sink:(D)V
+ 000a: const-wide/high16 v0, #double 1.0 // #3ff0000000000000
+ 000c: invoke-static {v0, v1}, Blort.sink:(D)V
+ 000f: const-wide/high16 v0, #double Infinity // #7ff0000000000000
+ 0011: invoke-static {v0, v1}, Blort.sink:(D)V
+ 0014: const-wide/high16 v0, #double NaN // #7ff8000000000000
+ 0016: invoke-static {v0, v1}, Blort.sink:(D)V
+ 0019: return-void
+Blort.testFloat:()V:
+regs: 0001; ins: 0000; outs: 0001
+ 0000: const/high16 v0, #float -Infinity // #ff800000
+ 0002: invoke-static {v0}, Blort.sink:(F)V
+ 0005: const/high16 v0, #float -0.0 // #80000000
+ 0007: invoke-static {v0}, Blort.sink:(F)V
+ 000a: const/high16 v0, #float 1.0 // #3f800000
+ 000c: invoke-static {v0}, Blort.sink:(F)V
+ 000f: const/high16 v0, #float Infinity // #7f800000
+ 0011: invoke-static {v0}, Blort.sink:(F)V
+ 0014: const/high16 v0, #float NaN // #7fc00000
+ 0016: invoke-static {v0}, Blort.sink:(F)V
+ 0019: return-void
+Blort.testInt:()V:
+regs: 0001; ins: 0000; outs: 0001
+ 0000: const/high16 v0, #int -2147483648 // #80000000
+ 0002: invoke-static {v0}, Blort.sink:(I)V
+ 0005: const/high16 v0, #int 1073741824 // #40000000
+ 0007: invoke-static {v0}, Blort.sink:(I)V
+ 000a: const/high16 v0, #int 536870912 // #20000000
+ 000c: invoke-static {v0}, Blort.sink:(I)V
+ 000f: const/high16 v0, #int 268435456 // #10000000
+ 0011: invoke-static {v0}, Blort.sink:(I)V
+ 0014: const/high16 v0, #int 524288 // #00080000
+ 0016: invoke-static {v0}, Blort.sink:(I)V
+ 0019: const/high16 v0, #int 262144 // #00040000
+ 001b: invoke-static {v0}, Blort.sink:(I)V
+ 001e: const/high16 v0, #int 131072 // #00020000
+ 0020: invoke-static {v0}, Blort.sink:(I)V
+ 0023: const/high16 v0, #int 65536 // #00010000
+ 0025: invoke-static {v0}, Blort.sink:(I)V
+ 0028: const/high16 v0, #int 1450704896 // #56780000
+ 002a: invoke-static {v0}, Blort.sink:(I)V
+ 002d: return-void
+Blort.testLong:()V:
+regs: 0002; ins: 0000; outs: 0002
+ 0000: const-wide/high16 v0, #long -9223372036854775808 // #8000000000000000
+ 0002: invoke-static {v0, v1}, Blort.sink:(J)V
+ 0005: const-wide/high16 v0, #long 4611686018427387904 // #4000000000000000
+ 0007: invoke-static {v0, v1}, Blort.sink:(J)V
+ 000a: const-wide/high16 v0, #long 2305843009213693952 // #2000000000000000
+ 000c: invoke-static {v0, v1}, Blort.sink:(J)V
+ 000f: const-wide/high16 v0, #long 1152921504606846976 // #1000000000000000
+ 0011: invoke-static {v0, v1}, Blort.sink:(J)V
+ 0014: const-wide/high16 v0, #long 2251799813685248 // #0008000000000000
+ 0016: invoke-static {v0, v1}, Blort.sink:(J)V
+ 0019: const-wide/high16 v0, #long 1125899906842624 // #0004000000000000
+ 001b: invoke-static {v0, v1}, Blort.sink:(J)V
+ 001e: const-wide/high16 v0, #long 562949953421312 // #0002000000000000
+ 0020: invoke-static {v0, v1}, Blort.sink:(J)V
+ 0023: const-wide/high16 v0, #long 281474976710656 // #0001000000000000
+ 0025: invoke-static {v0, v1}, Blort.sink:(J)V
+ 0028: const-wide/high16 v0, #long 6230730084467081216 // #5678000000000000
+ 002a: invoke-static {v0, v1}, Blort.sink:(J)V
+ 002d: return-void
diff --git a/dx/tests/054-dex-high16/info.txt b/dx/tests/054-dex-high16/info.txt
new file mode 100644
index 0000000..ef1fac4
--- /dev/null
+++ b/dx/tests/054-dex-high16/info.txt
@@ -0,0 +1,6 @@
+This is a smoke test of dex conversion, which checks to see that
+"high16" constants get converted properly.
+
+This test compares emitted code against a known-good (via eyeballing)
+version, so it is possible for this test to spuriously fail if other
+aspects of conversion end up altering the output in innocuous ways.
diff --git a/dx/tests/054-dex-high16/run b/dx/tests/054-dex-high16/run
new file mode 100644
index 0000000..a2c7458
--- /dev/null
+++ b/dx/tests/054-dex-high16/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright (C) 2007 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.
+
+$JAVAC -d . Blort.java
+dx --debug --dex --positions=none --no-locals \
+ --dump-method=Blort.test'*' *.class