summaryrefslogtreecommitdiffstats
path: root/test/458-long-to-fpu
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-03-09 10:28:50 +0000
committerNicolas Geoffray <ngeoffray@google.com>2015-03-11 14:23:38 +0000
commit234d69d075d1608f80adb647f7935077b62b6376 (patch)
treef6b68ff38722dc91bd0de2387609ee0ce950e0ce /test/458-long-to-fpu
parent31df246d330c45f5691e226d176d0c59450f8435 (diff)
downloadart-234d69d075d1608f80adb647f7935077b62b6376.zip
art-234d69d075d1608f80adb647f7935077b62b6376.tar.gz
art-234d69d075d1608f80adb647f7935077b62b6376.tar.bz2
Revert "Revert "[optimizing] Enable x86 long support.""
This reverts commit 154552e666347d41d95d7619c6ee56249ff4feca. Change-Id: Idc726551c249a888b7ff5fde8508ae50e81b2e13
Diffstat (limited to 'test/458-long-to-fpu')
-rw-r--r--test/458-long-to-fpu/expected.txt2
-rw-r--r--test/458-long-to-fpu/info.txt2
-rw-r--r--test/458-long-to-fpu/src/Main.java46
3 files changed, 50 insertions, 0 deletions
diff --git a/test/458-long-to-fpu/expected.txt b/test/458-long-to-fpu/expected.txt
new file mode 100644
index 0000000..daaac9e
--- /dev/null
+++ b/test/458-long-to-fpu/expected.txt
@@ -0,0 +1,2 @@
+42
+42
diff --git a/test/458-long-to-fpu/info.txt b/test/458-long-to-fpu/info.txt
new file mode 100644
index 0000000..7459cfb
--- /dev/null
+++ b/test/458-long-to-fpu/info.txt
@@ -0,0 +1,2 @@
+Regression test for x86's code generator, which had a bug in
+the long-to-float and long-to-double implementations.
diff --git a/test/458-long-to-fpu/src/Main.java b/test/458-long-to-fpu/src/Main.java
new file mode 100644
index 0000000..a8b6e78
--- /dev/null
+++ b/test/458-long-to-fpu/src/Main.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 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 Main {
+ public static void main(String[] args) {
+ System.out.println(floatConvert(false));
+ System.out.println(doubleConvert(false));
+ }
+
+ public static long floatConvert(boolean flag) {
+ if (flag) {
+ // Try defeating inlining.
+ floatConvert(false);
+ }
+ long l = myLong;
+ myFloat = (float)l;
+ return l;
+ }
+
+ public static long doubleConvert(boolean flag) {
+ if (flag) {
+ // Try defeating inlining.
+ floatConvert(false);
+ }
+ long l = myLong;
+ myFloat = (float)l;
+ return l;
+ }
+
+ public static long myLong = 42;
+ public static float myFloat = 2.0f;
+ public static double myDouble = 4.0d;
+}