summaryrefslogtreecommitdiff
path: root/dx/tests/084-dex-high-register-moves
diff options
context:
space:
mode:
Diffstat (limited to 'dx/tests/084-dex-high-register-moves')
-rw-r--r--dx/tests/084-dex-high-register-moves/Blort.java49
-rw-r--r--dx/tests/084-dex-high-register-moves/expected.txt58
-rw-r--r--dx/tests/084-dex-high-register-moves/info.txt7
-rw-r--r--dx/tests/084-dex-high-register-moves/run19
4 files changed, 133 insertions, 0 deletions
diff --git a/dx/tests/084-dex-high-register-moves/Blort.java b/dx/tests/084-dex-high-register-moves/Blort.java
new file mode 100644
index 0000000..e68ebd8
--- /dev/null
+++ b/dx/tests/084-dex-high-register-moves/Blort.java
@@ -0,0 +1,49 @@
+/*
+ * 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
+{
+ private static int i;
+ private static long l;
+ private static Object o;
+
+ public static void test() {
+ int i0 = 0;
+ int i1 = 0;
+ int i2 = 0;
+ int i3 = 0;
+ int i4 = 0;
+ int i5 = 0;
+ int i6 = 0;
+ int i7 = 0;
+ int i8 = 0;
+ int i9 = 0;
+ int i10 = 0;
+ int i11 = 0;
+ int i12 = 0;
+ int i13 = 0;
+ int i14 = 0;
+ int i15 = 0;
+
+ int ix = i;
+ long lx = l;
+ Object ox = o;
+
+ i = -ix;
+ l = -lx;
+ i = (ox instanceof String) ? 0 : 1;
+ }
+}
diff --git a/dx/tests/084-dex-high-register-moves/expected.txt b/dx/tests/084-dex-high-register-moves/expected.txt
new file mode 100644
index 0000000..061e7d3
--- /dev/null
+++ b/dx/tests/084-dex-high-register-moves/expected.txt
@@ -0,0 +1,58 @@
+Blort.test:()V:
+regs: 0018; ins: 0000; outs: 0000
+ 0000: const/16 v22, #int 0 // #0000
+ 0002: move/from16 v2, v22
+ 0004: const/16 v22, #int 0 // #0000
+ 0006: move/from16 v3, v22
+ 0008: const/16 v22, #int 0 // #0000
+ 000a: move/from16 v4, v22
+ 000c: const/16 v22, #int 0 // #0000
+ 000e: move/from16 v5, v22
+ 0010: const/16 v22, #int 0 // #0000
+ 0012: move/from16 v6, v22
+ 0014: const/16 v22, #int 0 // #0000
+ 0016: move/from16 v7, v22
+ 0018: const/16 v22, #int 0 // #0000
+ 001a: move/from16 v8, v22
+ 001c: const/16 v22, #int 0 // #0000
+ 001e: move/from16 v9, v22
+ 0020: const/16 v22, #int 0 // #0000
+ 0022: move/from16 v10, v22
+ 0024: const/16 v22, #int 0 // #0000
+ 0026: move/from16 v11, v22
+ 0028: const/16 v22, #int 0 // #0000
+ 002a: move/from16 v12, v22
+ 002c: const/16 v22, #int 0 // #0000
+ 002e: move/from16 v13, v22
+ 0030: const/16 v22, #int 0 // #0000
+ 0032: move/from16 v14, v22
+ 0034: const/16 v22, #int 0 // #0000
+ 0036: move/from16 v15, v22
+ 0038: const/16 v22, #int 0 // #0000
+ 003a: move/from16 v16, v22
+ 003c: const/16 v22, #int 0 // #0000
+ 003e: move/from16 v17, v22
+ 0040: sget v22, Blort.i:I
+ 0042: move/from16 v18, v22
+ 0044: sget-wide v22, Blort.l:J
+ 0046: move-wide/from16 v19, v22
+ 0048: sget-object v22, Blort.o:Ljava/lang/Object;
+ 004a: move-object/from16 v21, v22
+ 004c: move/from16 v22, v18
+ 004e: move/from16 v0, v22
+ 0050: neg-int v0, v0
+ 0051: move/from16 v22, v0
+ 0053: sput v22, Blort.i:I
+ 0055: move-wide/from16 v22, v19
+ 0057: move-wide/from16 v0, v22
+ 0059: neg-long v0, v0
+ 005a: move-wide/from16 v22, v0
+ 005c: sput-wide v22, Blort.l:J
+ 005e: move-object/from16 v22, v21
+ 0060: instance-of/jumbo v22, v22, java.lang.String
+ 0065: if-eqz v22, 006c // +0007
+ 0067: const/16 v22, #int 0 // #0000
+ 0069: sput v22, Blort.i:I
+ 006b: return-void
+ 006c: const/16 v22, #int 1 // #0001
+ 006e: goto 0069 // -0005
diff --git a/dx/tests/084-dex-high-register-moves/info.txt b/dx/tests/084-dex-high-register-moves/info.txt
new file mode 100644
index 0000000..77f0945
--- /dev/null
+++ b/dx/tests/084-dex-high-register-moves/info.txt
@@ -0,0 +1,7 @@
+This is a smoke test of dex conversion, which checks to make sure that
+high registers are moved to and from low registers with
+type-appropriate instructions.
+
+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/084-dex-high-register-moves/run b/dx/tests/084-dex-high-register-moves/run
new file mode 100644
index 0000000..3acfcfd
--- /dev/null
+++ b/dx/tests/084-dex-high-register-moves/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 -g -d . Blort.java
+dx --debug --dex --no-optimize --positions=none --no-locals \
+ --dump-method=Blort.test'*' *.class