summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/474-fp-sub-neg/expected.txt4
-rw-r--r--test/474-fp-sub-neg/info.txt6
-rw-r--r--test/474-fp-sub-neg/src/Main.java4
-rw-r--r--test/526-checker-caller-callee-regs/expected.txt0
-rw-r--r--test/526-checker-caller-callee-regs/info.txt1
-rw-r--r--test/526-checker-caller-callee-regs/src/Main.java73
-rwxr-xr-xtest/run-test32
7 files changed, 115 insertions, 5 deletions
diff --git a/test/474-fp-sub-neg/expected.txt b/test/474-fp-sub-neg/expected.txt
index e6ffe0d430..1c15abba3d 100644
--- a/test/474-fp-sub-neg/expected.txt
+++ b/test/474-fp-sub-neg/expected.txt
@@ -1,2 +1,6 @@
-0.0
+0.0
+0.0
-0.0
+0.0
+0.0
diff --git a/test/474-fp-sub-neg/info.txt b/test/474-fp-sub-neg/info.txt
index eced93fef5..82effdb45e 100644
--- a/test/474-fp-sub-neg/info.txt
+++ b/test/474-fp-sub-neg/info.txt
@@ -1,5 +1,11 @@
Regression check for optimizing simplify instruction pass.
+
A pair (sub, neg) should not be transforemd to (sub) for
fp calculation because we can lose the sign of zero for
the following expression:
- ( A - B ) != B - A ; if B == A
+
+Addition or subtraction with fp zero should not be eliminated
+because:
+ -0.0 + 0.0 = 0.0
+ -0.0 - -0.0 = 0.0
diff --git a/test/474-fp-sub-neg/src/Main.java b/test/474-fp-sub-neg/src/Main.java
index e6bce6793f..c190e8e40b 100644
--- a/test/474-fp-sub-neg/src/Main.java
+++ b/test/474-fp-sub-neg/src/Main.java
@@ -24,6 +24,8 @@ public class Main {
}
System.out.println(f);
+ System.out.println(f + 0f);
+ System.out.println(f - (-0f));
}
public static void doubleTest() {
@@ -35,6 +37,8 @@ public class Main {
}
System.out.println(d);
+ System.out.println(d + 0f);
+ System.out.println(d - (-0f));
}
public static void main(String[] args) {
diff --git a/test/526-checker-caller-callee-regs/expected.txt b/test/526-checker-caller-callee-regs/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/526-checker-caller-callee-regs/expected.txt
diff --git a/test/526-checker-caller-callee-regs/info.txt b/test/526-checker-caller-callee-regs/info.txt
new file mode 100644
index 0000000000..0e0373ac95
--- /dev/null
+++ b/test/526-checker-caller-callee-regs/info.txt
@@ -0,0 +1 @@
+Test allocation of caller and callee saved registers.
diff --git a/test/526-checker-caller-callee-regs/src/Main.java b/test/526-checker-caller-callee-regs/src/Main.java
new file mode 100644
index 0000000000..a1f33014ef
--- /dev/null
+++ b/test/526-checker-caller-callee-regs/src/Main.java
@@ -0,0 +1,73 @@
+/*
+ * 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 assertIntEquals(int expected, int result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ static boolean doThrow = false;
+
+ // This function always returns 1.
+ // We use 'throw' to prevent the function from being inlined.
+ public static int $opt$noinline$function_call(int arg) {
+ if (doThrow) throw new Error();
+ return 1 % arg;
+ }
+
+ // | registers available to | regexp
+ // | the register allocator |
+ // ------------------------------|------------------------|-----------------
+ // ARM64 callee-saved registers | [x20-x29] | x2[0-9]
+ // ARM callee-saved registers | [r5-r8,r10,r11] | r([5-8]|10|11)
+
+ /**
+ * Check that a value live across a function call is allocated in a callee
+ * saved register.
+ */
+
+ /// CHECK-START-ARM: int Main.$opt$LiveInCall(int) register (after)
+ /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
+ /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
+ /// CHECK: <<t1:i\d+>> Add [<<Arg>>,<<Const1>>] {{.*->r([5-8]|10|11)}}
+ /// CHECK: <<t2:i\d+>> InvokeStaticOrDirect
+ /// CHECK: Sub [<<t1>>,<<t2>>]
+ /// CHECK: Return
+
+ /// CHECK-START-ARM64: int Main.$opt$LiveInCall(int) register (after)
+ /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
+ /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
+ /// CHECK: <<t1:i\d+>> Add [<<Arg>>,<<Const1>>] {{.*->x2[0-9]}}
+ /// CHECK: <<t2:i\d+>> InvokeStaticOrDirect
+ /// CHECK: Sub [<<t1>>,<<t2>>]
+ /// CHECK: Return
+
+ // TODO: Add tests for other architectures.
+
+ public static int $opt$LiveInCall(int arg) {
+ int t1 = arg + 1;
+ int t2 = $opt$noinline$function_call(arg);
+ return t1 - t2;
+ }
+
+ public static void main(String[] args) {
+ int arg = 123;
+ assertIntEquals($opt$LiveInCall(arg), arg);
+ }
+}
diff --git a/test/run-test b/test/run-test
index 3d6f073d31..84c818b444 100755
--- a/test/run-test
+++ b/test/run-test
@@ -626,12 +626,19 @@ if [[ "$TEST_NAME" =~ ^[0-9]+-checker- ]]; then
# on a particular DEX output, keep building them with dx for now (b/19467889).
USE_JACK="false"
- if [ "$runtime" = "art" -a "$image_suffix" = "-optimizing" -a "$target_mode" = "no" -a "$debuggable" = "no" ]; then
+ if [ "$runtime" = "art" -a "$image_suffix" = "-optimizing" -a "$debuggable" = "no" ]; then
# In no-prebuild mode, the compiler is only invoked if both dex2oat and
# patchoat are available. Disable Checker otherwise (b/22552692).
if [ "$prebuild_mode" = "yes" ] || [ "$have_patchoat" = "yes" -a "$have_dex2oat" = "yes" ]; then
run_checker="yes"
- run_args="${run_args} -Xcompiler-option --dump-cfg=$tmp_dir/$cfg_output \
+ if [ "$target_mode" = "no" ]; then
+ cfg_output_dir="$tmp_dir"
+ checker_arch_option=
+ else
+ cfg_output_dir="$DEX_LOCATION"
+ checker_arch_option="--arch=${target_arch_name^^}"
+ fi
+ run_args="${run_args} -Xcompiler-option --dump-cfg=$cfg_output_dir/$cfg_output \
-Xcompiler-option -j1"
fi
fi
@@ -647,6 +654,12 @@ elif echo "$test_dir" | grep 083; then
build_file_size_limit=5120
run_file_size_limit=5120
fi
+if [ "$run_checker" = "yes" -a "$target_mode" = "yes" ]; then
+ # We will need to `adb pull` the .cfg output from the target onto the host to
+ # run checker on it. This file can be big.
+ build_file_size_limit=16384
+ run_file_size_limit=16384
+fi
if [ ${USE_JACK} = "false" ]; then
# Set ulimit if we build with dx only, Jack can generate big temp files.
if ! ulimit -S "$build_file_size_limit"; then
@@ -671,7 +684,10 @@ if [ "$dev_mode" = "yes" ]; then
if [ "$run_exit" = "0" ]; then
if [ "$run_checker" = "yes" ]; then
- "$checker" "$cfg_output" "$tmp_dir" 2>&1
+ if [ "$target_mode" = "yes" ]; then
+ adb pull $cfg_output_dir/$cfg_output &> /dev/null
+ fi
+ "$checker" $checker_arch_option "$cfg_output" "$tmp_dir" 2>&1
checker_exit="$?"
if [ "$checker_exit" = "0" ]; then
good="yes"
@@ -693,7 +709,10 @@ elif [ "$update_mode" = "yes" ]; then
echo "${test_dir}: running..." 1>&2
"./${run}" $run_args "$@" >"$output" 2>&1
if [ "$run_checker" = "yes" ]; then
- "$checker" -q "$cfg_output" "$tmp_dir" >> "$output" 2>&1
+ if [ "$target_mode" = "yes" ]; then
+ adb pull $cfg_output_dir/$cfg_output &> /dev/null
+ fi
+ "$checker" -q $checker_arch_option "$cfg_output" "$tmp_dir" >> "$output" 2>&1
fi
sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}"
good="yes"
@@ -731,7 +750,10 @@ else
echo "run exit status: $run_exit" 1>&2
good_run="no"
elif [ "$run_checker" = "yes" ]; then
- "$checker" -q "$cfg_output" "$tmp_dir" >> "$output" 2>&1
+ if [ "$target_mode" = "yes" ]; then
+ adb pull $cfg_output_dir/$cfg_output &> /dev/null
+ fi
+ "$checker" -q $checker_arch_option "$cfg_output" "$tmp_dir" >> "$output" 2>&1
checker_exit="$?"
if [ "$checker_exit" != "0" ]; then
echo "checker exit status: $checker_exit" 1>&2