diff options
Diffstat (limited to 'test')
67 files changed, 3583 insertions, 1819 deletions
diff --git a/test/004-ReferenceMap/build b/test/004-ReferenceMap/build index 08987b556c..3bb63ca624 100644 --- a/test/004-ReferenceMap/build +++ b/test/004-ReferenceMap/build @@ -21,6 +21,5 @@ set -e # (see b/19467889) mkdir classes ${JAVAC} -d classes `find src -name '*.java'` -${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex \ - --dump-width=1000 ${DX_FLAGS} classes +${DX} -JXmx256m --debug --dex --output=classes.dex ${DX_FLAGS} classes zip $TEST_NAME.jar classes.dex diff --git a/test/004-StackWalk/build b/test/004-StackWalk/build index 08987b556c..3bb63ca624 100644 --- a/test/004-StackWalk/build +++ b/test/004-StackWalk/build @@ -21,6 +21,5 @@ set -e # (see b/19467889) mkdir classes ${JAVAC} -d classes `find src -name '*.java'` -${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex \ - --dump-width=1000 ${DX_FLAGS} classes +${DX} -JXmx256m --debug --dex --output=classes.dex ${DX_FLAGS} classes zip $TEST_NAME.jar classes.dex diff --git a/test/004-ThreadStress/run b/test/004-ThreadStress/run index 8004036868..067e0d0407 100755 --- a/test/004-ThreadStress/run +++ b/test/004-ThreadStress/run @@ -15,7 +15,29 @@ # limitations under the License. # Enable lock contention logging. -${RUN} --runtime-option -Xlockprofthreshold:10 "${@}" +if [[ "x$ART_DEFAULT_GC_TYPE" = xGSS ]]; then + # NonMovingAlloc operations fail an assertion with the Generational + # Semi-Space (GSS) collector (see b/72738921); disable them for now + # by explicitly assigning frequencies to operations when the GSS + # collector is used. + # + # Note: The trick to use command substitution to have comments within + # a multi-line command is from https://stackoverflow.com/a/12797512. + ${RUN} --runtime-option -Xlockprofthreshold:10 "${@}" Main \ + -oom:0.005 `# 1/200` \ + -sigquit:0.095 `# 19/200` \ + -alloc:0.225 `# 45/200` \ + -largealloc:0.05 `# 10/200` \ + -nonmovingalloc:0.0 `# 0/200` \ + -stacktrace:0.1 `# 20/200` \ + -exit:0.225 `# 45/200` \ + -sleep:0.125 `# 25/200` \ + -timedwait:0.05 `# 10/200` \ + -wait:0.075 `# 15/200` \ + -queuedwait:0.05 `# 10/200` +else + ${RUN} --runtime-option -Xlockprofthreshold:10 "${@}" +fi return_status1=$? # Run locks-only mode with stack-dump lock profiling. Reduce the number of total operations from diff --git a/test/004-ThreadStress/src-art/Main.java b/test/004-ThreadStress/src-art/Main.java index a142934638..3a89f4f166 100644 --- a/test/004-ThreadStress/src-art/Main.java +++ b/test/004-ThreadStress/src-art/Main.java @@ -315,11 +315,9 @@ public class Main implements Runnable { Map<Operation, Double> frequencyMap = new HashMap<Operation, Double>(); frequencyMap.put(new OOM(), 0.005); // 1/200 frequencyMap.put(new SigQuit(), 0.095); // 19/200 - frequencyMap.put(new Alloc(), 0.225); // 45/200 + frequencyMap.put(new Alloc(), 0.2); // 40/200 frequencyMap.put(new LargeAlloc(), 0.05); // 10/200 - // TODO: NonMovingAlloc operations fail an assertion with the - // GSS collector (see b/72738921); disable them for now. - frequencyMap.put(new NonMovingAlloc(), 0.0); // 0/200 + frequencyMap.put(new NonMovingAlloc(), 0.025); // 5/200 frequencyMap.put(new StackTrace(), 0.1); // 20/200 frequencyMap.put(new Exit(), 0.225); // 45/200 frequencyMap.put(new Sleep(), 0.125); // 25/200 @@ -379,6 +377,8 @@ public class Main implements Runnable { op = new Alloc(); } else if (split[0].equals("-largealloc")) { op = new LargeAlloc(); + } else if (split[0].equals("-nonmovingalloc")) { + op = new NonMovingAlloc(); } else if (split[0].equals("-stacktrace")) { op = new StackTrace(); } else if (split[0].equals("-exit")) { diff --git a/test/022-interface/build b/test/022-interface/build index f6aad91e97..ab1c822ebf 100644 --- a/test/022-interface/build +++ b/test/022-interface/build @@ -17,6 +17,6 @@ # Stop if something fails. set -e -${DX} --debug --dex --dump-to=classes.lst --output=classes.dex classes +${DX} --debug --dex --output=classes.dex classes zip $TEST_NAME.jar classes.dex diff --git a/test/091-override-package-private-method/build b/test/091-override-package-private-method/build index ea12b3a540..e5fa6693a3 100755 --- a/test/091-override-package-private-method/build +++ b/test/091-override-package-private-method/build @@ -24,8 +24,8 @@ mkdir classes-ex mv classes/OverridePackagePrivateMethodSuper.class classes-ex if [ ${NEED_DEX} = "true" ]; then - ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex --dump-width=1000 classes + ${DX} -JXmx256m --debug --dex --output=classes.dex classes zip $TEST_NAME.jar classes.dex - ${DX} -JXmx256m --debug --dex --dump-to=classes-ex.lst --output=classes.dex --dump-width=1000 classes-ex + ${DX} -JXmx256m --debug --dex --output=classes.dex classes-ex zip ${TEST_NAME}-ex.jar classes.dex fi diff --git a/test/111-unresolvable-exception/build b/test/111-unresolvable-exception/build index 6fe73af8d8..f24c5b2004 100644 --- a/test/111-unresolvable-exception/build +++ b/test/111-unresolvable-exception/build @@ -22,6 +22,6 @@ ${JAVAC} -d classes `find src -name '*.java'` rm classes/TestException.class if [ ${NEED_DEX} = "true" ]; then - ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes + ${DX} -JXmx256m --debug --dex --output=classes.dex classes zip $TEST_NAME.jar classes.dex fi diff --git a/test/113-multidex/build b/test/113-multidex/build index f945563939..4ad7cb9134 100644 --- a/test/113-multidex/build +++ b/test/113-multidex/build @@ -29,9 +29,9 @@ rm classes2/Second.class classes2/FillerA.class classes2/FillerB.class classes2/ if [ ${NEED_DEX} = "true" ]; then # All except Main - ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes + ${DX} -JXmx256m --debug --dex --output=classes.dex classes # Only Main - ${DX} -JXmx256m --debug --dex --dump-to=classes2.lst --output=classes2.dex classes2 + ${DX} -JXmx256m --debug --dex --output=classes2.dex classes2 zip $TEST_NAME.jar classes.dex classes2.dex fi diff --git a/test/126-miranda-multidex/build b/test/126-miranda-multidex/build index cf19855316..b4bb88d644 100644 --- a/test/126-miranda-multidex/build +++ b/test/126-miranda-multidex/build @@ -29,9 +29,9 @@ rm classes2/Main.class classes2/MirandaAbstract.class classes2/MirandaClass*.cla if [ ${NEED_DEX} = "true" ]; then # All except Main - ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes + ${DX} -JXmx256m --debug --dex --output=classes.dex classes # Only Main - ${DX} -JXmx256m --debug --dex --dump-to=classes2.lst --output=classes2.dex classes2 + ${DX} -JXmx256m --debug --dex --output=classes2.dex classes2 zip $TEST_NAME.jar classes.dex classes2.dex fi diff --git a/test/127-checker-secondarydex/build b/test/127-checker-secondarydex/build index 712774f7ef..c23b7613b9 100755 --- a/test/127-checker-secondarydex/build +++ b/test/127-checker-secondarydex/build @@ -24,8 +24,8 @@ mkdir classes-ex mv classes/Super.class classes-ex if [ ${NEED_DEX} = "true" ]; then - ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex --dump-width=1000 classes + ${DX} -JXmx256m --debug --dex --output=classes.dex classes zip $TEST_NAME.jar classes.dex - ${DX} -JXmx256m --debug --dex --dump-to=classes-ex.lst --output=classes.dex --dump-width=1000 classes-ex + ${DX} -JXmx256m --debug --dex --output=classes.dex classes-ex zip ${TEST_NAME}-ex.jar classes.dex fi diff --git a/test/137-cfi/cfi.cc b/test/137-cfi/cfi.cc index a91d348441..985d27309e 100644 --- a/test/137-cfi/cfi.cc +++ b/test/137-cfi/cfi.cc @@ -54,15 +54,38 @@ static void CauseSegfault() { #endif } -extern "C" JNIEXPORT jboolean JNICALL Java_Main_sleep(JNIEnv*, jobject, jint, jboolean, jdouble) { - // Keep pausing. - struct timespec ts = { .tv_sec = 100, .tv_nsec = 0 }; - printf("Going to sleep\n"); - for (;;) { - // Use nanosleep since it gets to the system call quickly and doesn't - // have any points at which an unwind will fail. - nanosleep(&ts, nullptr); +extern "C" JNIEXPORT jint JNICALL Java_Main_startSecondaryProcess(JNIEnv*, jclass) { +#if __linux__ + // Get our command line so that we can use it to start identical process. + std::string cmdline; // null-separated and null-terminated arguments. + ReadFileToString("/proc/self/cmdline", &cmdline); + cmdline = cmdline + "--secondary" + '\0'; // Let the child know it is a helper. + + // Split the string into individual arguments suitable for execv. + std::vector<char*> argv; + for (size_t i = 0; i < cmdline.size(); i += strlen(&cmdline[i]) + 1) { + argv.push_back(&cmdline[i]); + } + argv.push_back(nullptr); // Terminate the list. + + pid_t pid = fork(); + if (pid < 0) { + LOG(FATAL) << "Fork failed"; + } else if (pid == 0) { + execv(argv[0], argv.data()); + exit(1); } + return pid; +#else + return 0; +#endif +} + +extern "C" JNIEXPORT jboolean JNICALL Java_Main_sigstop(JNIEnv*, jclass) { +#if __linux__ + raise(SIGSTOP); +#endif + return true; // Prevent the compiler from tail-call optimizing this method away. } // Helper to look for a sequence in the stack trace. @@ -107,12 +130,7 @@ static void MoreErrorInfo(pid_t pid, bool sig_quit_on_fail) { } #endif -extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindInProcess( - JNIEnv*, - jobject, - jboolean, - jint, - jboolean) { +extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindInProcess(JNIEnv*, jclass) { #if __linux__ std::unique_ptr<Backtrace> bt(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, GetTid())); if (!bt->Unwind(0, nullptr)) { @@ -128,10 +146,10 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindInProcess( // only unique functions are being expected. // "mini-debug-info" does not include parameters to save space. std::vector<std::string> seq = { - "Java_Main_unwindInProcess", // This function. - "java.util.Arrays.binarySearch0", // Framework method. - "Base.runBase", // Method in other dex file. - "Main.main" // The Java entry method. + "Java_Main_unwindInProcess", // This function. + "java.util.Arrays.binarySearch0", // Framework method. + "Base.runTest", // Method in other dex file. + "Main.main" // The Java entry method. }; bool result = CheckStack(bt.get(), seq); @@ -150,8 +168,8 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindInProcess( } #if __linux__ -static constexpr int kSleepTimeMicroseconds = 50000; // 0.05 seconds -static constexpr int kMaxTotalSleepTimeMicroseconds = 1000000; // 1 second +static constexpr int kSleepTimeMicroseconds = 50000; // 0.05 seconds +static constexpr int kMaxTotalSleepTimeMicroseconds = 10000000; // 10 seconds // Wait for a sigstop. This code is copied from libbacktrace. int wait_for_sigstop(pid_t tid, int* total_sleep_time_usec, bool* detach_failed ATTRIBUTE_UNUSED) { @@ -183,17 +201,12 @@ int wait_for_sigstop(pid_t tid, int* total_sleep_time_usec, bool* detach_failed } #endif -extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindOtherProcess( - JNIEnv*, - jobject, - jboolean, - jint pid_int) { +extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindOtherProcess(JNIEnv*, jclass, jint pid_int) { #if __linux__ pid_t pid = static_cast<pid_t>(pid_int); - // OK, this is painful. debuggerd uses ptrace to unwind other processes. - - if (ptrace(PTRACE_ATTACH, pid, 0, 0)) { + // SEIZE is like ATTACH, but it does not stop the process (we let it stop itself). + if (ptrace(PTRACE_SEIZE, pid, 0, 0)) { // Were not able to attach, bad. printf("Failed to attach to other process.\n"); PLOG(ERROR) << "Failed to attach."; @@ -201,13 +214,12 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindOtherProcess( return JNI_FALSE; } - kill(pid, SIGSTOP); - bool detach_failed = false; int total_sleep_time_usec = 0; int signal = wait_for_sigstop(pid, &total_sleep_time_usec, &detach_failed); - if (signal == -1) { + if (signal != SIGSTOP) { LOG(WARNING) << "wait_for_sigstop failed."; + return JNI_FALSE; } std::unique_ptr<Backtrace> bt(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD)); @@ -224,10 +236,10 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_unwindOtherProcess( // See comment in unwindInProcess for non-exact stack matching. // "mini-debug-info" does not include parameters to save space. std::vector<std::string> seq = { - "Java_Main_sleep", // The sleep function in the other process. - "java.util.Arrays.binarySearch0", // Framework method. - "Base.runBase", // Method in other dex file. - "Main.main" // The Java entry method. + "Java_Main_sigstop", // The stop function in the other process. + "java.util.Arrays.binarySearch0", // Framework method. + "Base.runTest", // Method in other dex file. + "Main.main" // The Java entry method. }; result = CheckStack(bt.get(), seq); diff --git a/test/137-cfi/expected.txt b/test/137-cfi/expected.txt index 8db7853696..eedae8f51f 100644 --- a/test/137-cfi/expected.txt +++ b/test/137-cfi/expected.txt @@ -1,2 +1,7 @@ JNI_OnLoad called +Unwind in process: PASS JNI_OnLoad called +Unwind other process: PASS +JNI_OnLoad called +JNI_OnLoad called +Unwind other process: PASS diff --git a/test/137-cfi/run b/test/137-cfi/run index 9190b1cf10..4096b895ee 100755 --- a/test/137-cfi/run +++ b/test/137-cfi/run @@ -20,7 +20,7 @@ # there will be JITed frames on the callstack (it synchronously JITs on first use). ${RUN} "$@" -Xcompiler-option --generate-debug-info \ --runtime-option -Xjitthreshold:0 \ - --args --full-signatures --args --test-local --args --test-remote + --args --test-local --args --test-remote return_status1=$? # Test with minimal compressed debugging information. diff --git a/test/137-cfi/src-multidex/Base.java b/test/137-cfi/src-multidex/Base.java index d3f8a5681d..986a3c2226 100644 --- a/test/137-cfi/src-multidex/Base.java +++ b/test/137-cfi/src-multidex/Base.java @@ -15,8 +15,12 @@ */ public abstract class Base { - abstract public void runImpl(); - public void runBase() { - runImpl(); + public void runTest() throws Exception { + // Conditionally throw exception to prevent the compiler from inlining the code. + if (!this.getClass().getName().equals("Main")) { + throw new Exception("Who is calling?"); + } + test(); } + abstract public void test(); } diff --git a/test/137-cfi/src/Main.java b/test/137-cfi/src/Main.java index 9a2e352b8c..5b32d8e1fe 100644 --- a/test/137-cfi/src/Main.java +++ b/test/137-cfi/src/Main.java @@ -22,181 +22,68 @@ import java.util.Comparator; public class Main extends Base implements Comparator<Main> { // Whether to test local unwinding. - private boolean testLocal; + private static boolean testLocal; // Unwinding another process, modelling debuggerd. - private boolean testRemote; + private static boolean testRemote; // We fork ourself to create the secondary process for remote unwinding. - private boolean secondary; + private static boolean secondary; - // Expect the symbols to contain full method signatures including parameters. - private boolean fullSignatures; - - private boolean passed; - - public Main(String[] args) throws Exception { + public static void main(String[] args) throws Exception { System.loadLibrary(args[0]); - for (String arg : args) { - if (arg.equals("--test-local")) { + for (int i = 1; i < args.length; i++) { + if (args[i].equals("--test-local")) { testLocal = true; - } - if (arg.equals("--test-remote")) { + } else if (args[i].equals("--test-remote")) { testRemote = true; - } - if (arg.equals("--secondary")) { + } else if (args[i].equals("--secondary")) { secondary = true; + } else { + System.out.println("Unknown argument: " + args[i]); + System.exit(1); } - if (arg.equals("--full-signatures")) { - fullSignatures = true; - } - } - if (!testLocal && !testRemote) { - System.out.println("No test selected."); - } - } - - public static void main(String[] args) throws Exception { - new Main(args).runBase(); - } - - public void runImpl() { - if (secondary) { - if (!testRemote) { - throw new RuntimeException("Should not be running secondary!"); - } - runSecondary(); - } else { - runPrimary(); - } - } - - private void runSecondary() { - foo(); - throw new RuntimeException("Didn't expect to get back..."); - } - - private void runPrimary() { - // First do the in-process unwinding. - if (testLocal && !foo()) { - System.out.println("Unwinding self failed."); - } - - if (!testRemote) { - // Skip the remote step. - return; - } - - // Fork the secondary. - String[] cmdline = getCmdLine(); - String[] secCmdLine = new String[cmdline.length + 1]; - System.arraycopy(cmdline, 0, secCmdLine, 0, cmdline.length); - secCmdLine[secCmdLine.length - 1] = "--secondary"; - Process p = exec(secCmdLine); - - try { - int pid = getPid(p); - if (pid <= 0) { - throw new RuntimeException("Couldn't parse process"); - } - - // Wait until the forked process had time to run until its sleep phase. - BufferedReader lineReader; - try { - InputStreamReader stdout = new InputStreamReader(p.getInputStream(), "UTF-8"); - lineReader = new BufferedReader(stdout); - while (!lineReader.readLine().contains("Going to sleep")) { - } - } catch (Exception e) { - throw new RuntimeException(e); - } - - if (!unwindOtherProcess(fullSignatures, pid)) { - System.out.println("Unwinding other process failed."); - - // In this case, log all the output. - // Note: this is potentially non-terminating code, if the secondary is totally stuck. - // We rely on the run-test timeout infrastructure to terminate the primary in - // such a case. - try { - String tmp; - System.out.println("Output from the secondary:"); - while ((tmp = lineReader.readLine()) != null) { - System.out.println("Secondary: " + tmp); - } - } catch (Exception e) { - e.printStackTrace(System.out); - } - } - - try { - lineReader.close(); - } catch (Exception e) { - e.printStackTrace(System.out); - } - } finally { - // Kill the forked process if it is not already dead. - p.destroy(); } - } - private static Process exec(String[] args) { - try { - return Runtime.getRuntime().exec(args); - } catch (Exception exc) { - throw new RuntimeException(exc); - } + // Call test() via base class to test unwinding through multidex. + new Main().runTest(); } - private static int getPid(Process p) { - // Could do reflection for the private pid field, but String parsing is easier. - String s = p.toString(); - if (s.startsWith("Process[pid=")) { - return Integer.parseInt(s.substring("Process[pid=".length(), s.indexOf(","))); - } else { - return -1; - } - } - - // Read /proc/self/cmdline to find the invocation command line (so we can fork another runtime). - private static String[] getCmdLine() { - try { - BufferedReader in = new BufferedReader(new FileReader("/proc/self/cmdline")); - String s = in.readLine(); - in.close(); - return s.split("\0"); - } catch (Exception exc) { - throw new RuntimeException(exc); - } - } - - public boolean foo() { - // Call bar via Arrays.binarySearch. - // This tests that we can unwind from framework code. + public void test() { + // Call unwind() via Arrays.binarySearch to test unwinding through framework. Main[] array = { this, this, this }; Arrays.binarySearch(array, 0, 3, this /* value */, this /* comparator */); - return passed; } public int compare(Main lhs, Main rhs) { - passed = bar(secondary); + unwind(); // Returning "equal" ensures that we terminate search - // after first item and thus call bar() only once. + // after first item and thus call unwind() only once. return 0; } - public boolean bar(boolean b) { - if (b) { - return sleep(2, b, 1.0); - } else { - return unwindInProcess(fullSignatures, 1, b); + public void unwind() { + if (secondary) { + sigstop(); // This is helper child process. Stop and wait for unwinding. + return; // Don't run the tests again in the secondary helper process. } - } - // Native functions. Note: to avoid deduping, they must all have different signatures. + if (testLocal) { + String result = unwindInProcess() ? "PASS" : "FAIL"; + System.out.println("Unwind in process: " + result); + } - public native boolean sleep(int i, boolean b, double dummy); + if (testRemote) { + // Start a secondary helper process. It will stop itself when it is ready. + int pid = startSecondaryProcess(); + // Wait for the secondary process to stop and then unwind it remotely. + String result = unwindOtherProcess(pid) ? "PASS" : "FAIL"; + System.out.println("Unwind other process: " + result); + } + } - public native boolean unwindInProcess(boolean fullSignatures, int i, boolean b); - public native boolean unwindOtherProcess(boolean fullSignatures, int pid); + public static native int startSecondaryProcess(); + public static native boolean sigstop(); + public static native boolean unwindInProcess(); + public static native boolean unwindOtherProcess(int pid); } diff --git a/test/138-duplicate-classes-check2/build b/test/138-duplicate-classes-check2/build index 76d535abf1..3ff15aae38 100755 --- a/test/138-duplicate-classes-check2/build +++ b/test/138-duplicate-classes-check2/build @@ -25,8 +25,8 @@ ${JAVAC} -d classes-ex `find src-ex -name '*.java'` rm classes-ex/A.class if [ ${NEED_DEX} = "true" ]; then - ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex --dump-width=1000 classes + ${DX} -JXmx256m --debug --dex --output=classes.dex classes zip ${TEST_NAME}.jar classes.dex - ${DX} -JXmx256m --debug --dex --dump-to=classes-ex.lst --output=classes.dex --dump-width=1000 classes-ex + ${DX} -JXmx256m --debug --dex --output=classes.dex classes-ex zip ${TEST_NAME}-ex.jar classes.dex fi diff --git a/test/458-checker-instruct-simplification/src/Main.java b/test/458-checker-instruct-simplification/src/Main.java index 40e3778109..9e714f5111 100644 --- a/test/458-checker-instruct-simplification/src/Main.java +++ b/test/458-checker-instruct-simplification/src/Main.java @@ -2458,6 +2458,77 @@ public class Main { return (byte)((int)(((long)(b & 0xff)) & 255L)); } + /// CHECK-START: int Main.$noinline$emptyStringIndexOf(int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Empty:l\d+>> LoadString + /// CHECK-DAG: <<Equals:i\d+>> InvokeVirtual [<<Empty>>,<<Arg>>] intrinsic:StringIndexOf + /// CHECK-DAG: Return [<<Equals>>] + + /// CHECK-START: int Main.$noinline$emptyStringIndexOf(int) instruction_simplifier (after) + /// CHECK-NOT: InvokeVirtual + + /// CHECK-START: int Main.$noinline$emptyStringIndexOf(int) instruction_simplifier (after) + /// CHECK-DAG: <<Minus1:i\d+>> IntConstant -1 + /// CHECK-DAG: Return [<<Minus1>>] + public static int $noinline$emptyStringIndexOf(int ch) { + return "".indexOf(ch); + } + + /// CHECK-START: int Main.$noinline$emptyStringIndexOfAfter(int, int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg1:i\d+>> ParameterValue + /// CHECK-DAG: <<Arg2:i\d+>> ParameterValue + /// CHECK-DAG: <<Empty:l\d+>> LoadString + /// CHECK-DAG: <<Equals:i\d+>> InvokeVirtual [<<Empty>>,<<Arg1>>,<<Arg2>>] intrinsic:StringIndexOfAfter + /// CHECK-DAG: Return [<<Equals>>] + + /// CHECK-START: int Main.$noinline$emptyStringIndexOfAfter(int, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeVirtual + + /// CHECK-START: int Main.$noinline$emptyStringIndexOfAfter(int, int) instruction_simplifier (after) + /// CHECK-DAG: <<Minus1:i\d+>> IntConstant -1 + /// CHECK-DAG: Return [<<Minus1>>] + public static int $noinline$emptyStringIndexOfAfter(int ch, int fromIndex) { + return "".indexOf(ch, fromIndex); + } + + /// CHECK-START: int Main.$noinline$singleCharStringIndexOf(int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Empty:l\d+>> LoadString + /// CHECK-DAG: <<Equals:i\d+>> InvokeVirtual [<<Empty>>,<<Arg>>] intrinsic:StringIndexOf + /// CHECK-DAG: Return [<<Equals>>] + + /// CHECK-START: int Main.$noinline$singleCharStringIndexOf(int) instruction_simplifier (after) + /// CHECK-NOT: InvokeVirtual + + /// CHECK-START: int Main.$noinline$singleCharStringIndexOf(int) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<x:i\d+>> IntConstant 120 + /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 + /// CHECK-DAG: <<Minus1:i\d+>> IntConstant -1 + /// CHECK-DAG: <<Eq:z\d+>> Equal [<<Arg>>,<<x>>] + /// CHECK-DAG: <<Select:i\d+>> Select [<<Minus1>>,<<Zero>>,<<Eq>>] + /// CHECK-DAG: Return [<<Select>>] + public static int $noinline$singleCharStringIndexOf(int ch) { + return "x".indexOf(ch); + } + + /// CHECK-START: int Main.$noinline$singleCharStringIndexOfAfter(int, int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg1:i\d+>> ParameterValue + /// CHECK-DAG: <<Arg2:i\d+>> ParameterValue + /// CHECK-DAG: <<Empty:l\d+>> LoadString + /// CHECK-DAG: <<Equals:i\d+>> InvokeVirtual [<<Empty>>,<<Arg1>>,<<Arg2>>] intrinsic:StringIndexOfAfter + /// CHECK-DAG: Return [<<Equals>>] + + /// CHECK-START: int Main.$noinline$singleCharStringIndexOfAfter(int, int) instruction_simplifier (after) + /// CHECK-DAG: <<Arg1:i\d+>> ParameterValue + /// CHECK-DAG: <<Arg2:i\d+>> ParameterValue + /// CHECK-DAG: <<Empty:l\d+>> LoadString + /// CHECK-DAG: <<Equals:i\d+>> InvokeVirtual [<<Empty>>,<<Arg1>>,<<Arg2>>] intrinsic:StringIndexOfAfter + /// CHECK-DAG: Return [<<Equals>>] + public static int $noinline$singleCharStringIndexOfAfter(int ch, int fromIndex) { + return "x".indexOf(ch, fromIndex); // Not simplified. + } + public static void main(String[] args) throws Exception { Class smaliTests2 = Class.forName("SmaliTests2"); Method $noinline$XorAllOnes = smaliTests2.getMethod("$noinline$XorAllOnes", int.class); @@ -2709,6 +2780,19 @@ public class Main { assertIntEquals(1, (int)$noinline$bug68142795Boolean.invoke(null, true)); assertIntEquals(0x7f, $noinline$bug68142795Elaborate((byte) 0x7f)); assertIntEquals((byte) 0x80, $noinline$bug68142795Elaborate((byte) 0x80)); + + assertIntEquals(-1, $noinline$emptyStringIndexOf('a')); + assertIntEquals(-1, $noinline$emptyStringIndexOf('Z')); + assertIntEquals(-1, $noinline$emptyStringIndexOfAfter('a', 0)); + assertIntEquals(-1, $noinline$emptyStringIndexOfAfter('Z', -1)); + + assertIntEquals(-1, $noinline$singleCharStringIndexOf('a')); + assertIntEquals(0, $noinline$singleCharStringIndexOf('x')); + assertIntEquals(-1, $noinline$singleCharStringIndexOf('Z')); + assertIntEquals(-1, $noinline$singleCharStringIndexOfAfter('a', 0)); + assertIntEquals(0, $noinline$singleCharStringIndexOfAfter('x', -1)); + assertIntEquals(-1, $noinline$singleCharStringIndexOfAfter('x', 1)); + assertIntEquals(-1, $noinline$singleCharStringIndexOfAfter('Z', -1)); } private static boolean $inline$true() { return true; } diff --git a/test/466-get-live-vreg/get_live_vreg_jni.cc b/test/466-get-live-vreg/get_live_vreg_jni.cc index 44ea0c9877..58ffe04fee 100644 --- a/test/466-get-live-vreg/get_live_vreg_jni.cc +++ b/test/466-get-live-vreg/get_live_vreg_jni.cc @@ -36,32 +36,46 @@ class TestVisitor : public StackVisitor { ArtMethod* m = GetMethod(); std::string m_name(m->GetName()); - if (m_name.compare("testLiveArgument") == 0) { + if (m_name.compare("$noinline$testLiveArgument") == 0) { + found_method_ = true; + CHECK_EQ(CodeItemDataAccessor(m->DexInstructionData()).RegistersSize(), 3u); + CheckOptimizedOutRegLiveness(m, 1, kIntVReg, true, 42); + + uint32_t value; + CHECK(GetVReg(m, 2, kReferenceVReg, &value)); + } else if (m_name.compare("$noinline$testIntervalHole") == 0) { found_method_ = true; - uint32_t value = 0; - CHECK(GetVReg(m, 0, kIntVReg, &value)); - CHECK_EQ(value, 42u); - } else if (m_name.compare("$opt$noinline$testIntervalHole") == 0) { uint32_t number_of_dex_registers = CodeItemDataAccessor(m->DexInstructionData()).RegistersSize(); uint32_t dex_register_of_first_parameter = number_of_dex_registers - 2; + CheckOptimizedOutRegLiveness(m, dex_register_of_first_parameter, kIntVReg, true, 1); + } else if (m_name.compare("$noinline$testCodeSinking") == 0) { found_method_ = true; - uint32_t value = 0; - if (GetCurrentQuickFrame() != nullptr && - GetCurrentOatQuickMethodHeader()->IsOptimized() && - !Runtime::Current()->IsJavaDebuggable()) { - CHECK_EQ(GetVReg(m, dex_register_of_first_parameter, kIntVReg, &value), false); - } else { - CHECK(GetVReg(m, dex_register_of_first_parameter, kIntVReg, &value)); - CHECK_EQ(value, 1u); - } + CheckOptimizedOutRegLiveness(m, 0, kReferenceVReg); } return true; } - // Value returned to Java to ensure the methods testSimpleVReg and testPairVReg - // have been found and tested. + void CheckOptimizedOutRegLiveness(ArtMethod* m, + uint32_t dex_reg, + VRegKind vreg_kind, + bool check_val = false, + uint32_t expected = 0) REQUIRES_SHARED(Locks::mutator_lock_) { + uint32_t value = 0; + if (GetCurrentQuickFrame() != nullptr && + GetCurrentOatQuickMethodHeader()->IsOptimized() && + !Runtime::Current()->IsJavaDebuggable()) { + CHECK_EQ(GetVReg(m, dex_reg, vreg_kind, &value), false); + } else { + CHECK(GetVReg(m, dex_reg, vreg_kind, &value)); + if (check_val) { + CHECK_EQ(value, expected); + } + } + } + + // Value returned to Java to ensure the required methods have been found and tested. bool found_method_ = false; }; diff --git a/test/466-get-live-vreg/src/Main.java b/test/466-get-live-vreg/src/Main.java index 19032601fa..29a6901a70 100644 --- a/test/466-get-live-vreg/src/Main.java +++ b/test/466-get-live-vreg/src/Main.java @@ -18,9 +18,9 @@ public class Main { public Main() { } - static int testLiveArgument(int arg) { + static int $noinline$testLiveArgument(int arg1, Integer arg2) { doStaticNativeCallLiveVreg(); - return arg; + return arg1 + arg2.intValue(); } static void moveArgToCalleeSave() { @@ -31,7 +31,7 @@ public class Main { } } - static void $opt$noinline$testIntervalHole(int arg, boolean test) { + static void $noinline$testIntervalHole(int arg, boolean test) { // Move the argument to callee save to ensure it is in // a readable register. moveArgToCalleeSave(); @@ -53,16 +53,18 @@ public class Main { public static void main(String[] args) { System.loadLibrary(args[0]); - if (testLiveArgument(staticField3) != staticField3) { - throw new Error("Expected " + staticField3); + if ($noinline$testLiveArgument(staticField3, Integer.valueOf(1)) != staticField3 + 1) { + throw new Error("Expected " + staticField3 + 1); } - if (testLiveArgument(staticField3) != staticField3) { - throw new Error("Expected " + staticField3); + if ($noinline$testLiveArgument(staticField3,Integer.valueOf(1)) != staticField3 + 1) { + throw new Error("Expected " + staticField3 + 1); } testWrapperIntervalHole(1, true); testWrapperIntervalHole(1, false); + + $noinline$testCodeSinking(1); } // Wrapper method to avoid inlining, which affects liveness @@ -70,12 +72,25 @@ public class Main { static void testWrapperIntervalHole(int arg, boolean test) { try { Thread.sleep(0); - $opt$noinline$testIntervalHole(arg, test); + $noinline$testIntervalHole(arg, test); } catch (Exception e) { throw new Error(e); } } + // The value of dex register which originally holded "Object[] o = new Object[1];" will not be + // live at the call to doStaticNativeCallLiveVreg after code sinking optimizizaion. + static void $noinline$testCodeSinking(int x) { + Object[] o = new Object[1]; + o[0] = o; + doStaticNativeCallLiveVreg(); + if (doThrow) { + throw new Error(o.toString()); + } + } + + static boolean doThrow; + static int staticField1; static int staticField2; static int staticField3 = 42; diff --git a/test/477-checker-bound-type/src/Main.java b/test/477-checker-bound-type/src/Main.java index 2504ab2839..237e4dafb6 100644 --- a/test/477-checker-bound-type/src/Main.java +++ b/test/477-checker-bound-type/src/Main.java @@ -57,5 +57,79 @@ public class Main { } } - public static void main(String[] args) { } + /// CHECK-START: void Main.boundTypeInLoop(int[]) licm (before) + /// CHECK-DAG: <<Param:l\d+>> ParameterValue loop:none + /// CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<BoundT:l\d+>> BoundType [<<Param>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayLength [<<BoundT>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayGet loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArraySet loop:<<Loop>> outer_loop:none + + /// CHECK-START: void Main.boundTypeInLoop(int[]) licm (after) + /// CHECK-DAG: <<Param:l\d+>> ParameterValue loop:none + /// CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<BoundT:l\d+>> BoundType [<<Param>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayLength [<<BoundT>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayGet loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArraySet loop:<<Loop>> outer_loop:none + // + /// CHECK-NOT: BoundType + + /// CHECK-START: void Main.boundTypeInLoop(int[]) loop_optimization (after) + /// CHECK-DAG: <<Param:l\d+>> ParameterValue loop:none + /// CHECK-DAG: <<BoundTA:l\d+>> BoundType [<<Param>>] loop:none + /// CHECK-DAG: ArrayLength [<<BoundTA>>] loop:none + /// CHECK-DAG: ArrayGet loop:none + /// CHECK-DAG: ArraySet loop:none + /// CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<BoundT:l\d+>> BoundType [<<Param>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayLength [<<BoundT>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayGet loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArraySet loop:<<Loop>> outer_loop:none + + /// CHECK-START: void Main.boundTypeInLoop(int[]) GVN$after_arch (after) + /// CHECK-DAG: <<Param:l\d+>> ParameterValue loop:none + /// CHECK-DAG: <<BoundTA:l\d+>> BoundType [<<Param>>] loop:none + /// CHECK-DAG: ArrayLength [<<BoundTA>>] loop:none + /// CHECK-DAG: ArrayGet loop:none + /// CHECK-DAG: ArraySet loop:none + /// CHECK-DAG: <<Phi:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: ArrayGet loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArraySet loop:<<Loop>> outer_loop:none + // + /// CHECK-NOT: BoundType + /// CHECK-NOT: ArrayLength + private static void boundTypeInLoop(int[] a) { + for (int i = 0; a != null && i < a.length; i++) { + a[i] += 1; + } + } + + // BoundType must not be hoisted by LICM, in this example it leads to ArrayLength being + // hoisted as well which is invalid. + // + /// CHECK-START: void Main.BoundTypeNoLICM(java.lang.Object) licm (before) + /// CHECK-DAG: <<Param:l\d+>> ParameterValue loop:none + /// CHECK-DAG: SuspendCheck loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Bound1:l\d+>> BoundType [<<Param>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Bound2:l\d+>> BoundType [<<Bound1>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayLength [<<Bound2>>] loop:<<Loop>> outer_loop:none + // + /// CHECK-START: void Main.BoundTypeNoLICM(java.lang.Object) licm (after) + /// CHECK-DAG: <<Param:l\d+>> ParameterValue loop:none + /// CHECK-DAG: SuspendCheck loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Bound1:l\d+>> BoundType [<<Param>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Bound2:l\d+>> BoundType [<<Bound1>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: ArrayLength [<<Bound2>>] loop:<<Loop>> outer_loop:none + // + /// CHECK-NOT: BoundType loop:none + private static void BoundTypeNoLICM(Object obj) { + int i = 0; + while (obj instanceof int[]) { + int[] a = (int[])obj; + a[0] = 1; + } + } + + public static void main(String[] args) { } } diff --git a/test/530-checker-lse2/build b/test/530-checker-lse2/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/530-checker-lse2/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/565-checker-condition-liveness/info.txt b/test/565-checker-condition-liveness/info.txt index 67b6ceb53f..e716c04491 100644 --- a/test/565-checker-condition-liveness/info.txt +++ b/test/565-checker-condition-liveness/info.txt @@ -1 +1 @@ -Test the use positions of inputs of non-materialized conditions.
\ No newline at end of file +Test the results of liveness analysis e.g. use positions of inputs of non-materialized conditions.
\ No newline at end of file diff --git a/test/565-checker-condition-liveness/src/Main.java b/test/565-checker-condition-liveness/src/Main.java index acfcecdba8..6b6619fa43 100644 --- a/test/565-checker-condition-liveness/src/Main.java +++ b/test/565-checker-condition-liveness/src/Main.java @@ -31,6 +31,82 @@ public class Main { return (arg > 5.0f) ? 0 : -1; } + /// CHECK-START: void Main.testThrowIntoCatchBlock(int, java.lang.Object, int[]) liveness (after) + /// CHECK-DAG: <<IntArg:i\d+>> ParameterValue env_uses:[21,25] + /// CHECK-DAG: <<RefArg:l\d+>> ParameterValue env_uses:[11,21,25] + /// CHECK-DAG: <<Array:l\d+>> ParameterValue env_uses:[11,21,25] + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 env_uses:[21,25] + /// CHECK-DAG: SuspendCheck env:[[_,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:10 + /// CHECK-DAG: NullCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:20 + /// CHECK-DAG: BoundsCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:24 + /// CHECK-DAG: TryBoundary + + /// CHECK-START-DEBUGGABLE: void Main.testThrowIntoCatchBlock(int, java.lang.Object, int[]) liveness (after) + /// CHECK-DAG: <<IntArg:i\d+>> ParameterValue env_uses:[11,21,25] + /// CHECK-DAG: <<RefArg:l\d+>> ParameterValue env_uses:[11,21,25] + /// CHECK-DAG: <<Array:l\d+>> ParameterValue env_uses:[11,21,25] + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 env_uses:[21,25] + /// CHECK-DAG: SuspendCheck env:[[_,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:10 + /// CHECK-DAG: NullCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:20 + /// CHECK-DAG: BoundsCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:24 + /// CHECK-DAG: TryBoundary + // + // A value live at a throwing instruction in a try block may be copied by + // the exception handler to its location at the top of the catch block. + public static void testThrowIntoCatchBlock(int x, Object y, int[] a) { + try { + a[1] = x; + } catch (ArrayIndexOutOfBoundsException exception) { + } + } + + /// CHECK-START: void Main.testBoundsCheck(int, java.lang.Object, int[]) liveness (after) + /// CHECK-DAG: <<IntArg:i\d+>> ParameterValue env_uses:[] + /// CHECK-DAG: <<RefArg:l\d+>> ParameterValue env_uses:[11,17,21] + /// CHECK-DAG: <<Array:l\d+>> ParameterValue env_uses:[11,17,21] + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 env_uses:[] + /// CHECK-DAG: SuspendCheck env:[[_,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:10 + /// CHECK-DAG: NullCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:16 + /// CHECK-DAG: BoundsCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:20 + + /// CHECK-START-DEBUGGABLE: void Main.testBoundsCheck(int, java.lang.Object, int[]) liveness (after) + /// CHECK-DAG: <<IntArg:i\d+>> ParameterValue env_uses:[11,17,21] + /// CHECK-DAG: <<RefArg:l\d+>> ParameterValue env_uses:[11,17,21] + /// CHECK-DAG: <<Array:l\d+>> ParameterValue env_uses:[11,17,21] + /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 env_uses:[17,21] + /// CHECK-DAG: SuspendCheck env:[[_,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:10 + /// CHECK-DAG: NullCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:16 + /// CHECK-DAG: BoundsCheck env:[[<<Const1>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:20 + public static void testBoundsCheck(int x, Object y, int[] a) { + a[1] = x; + } + + /// CHECK-START: void Main.testDeoptimize(int, java.lang.Object, int[]) liveness (after) + /// CHECK-DAG: <<IntArg:i\d+>> ParameterValue env_uses:[25] + /// CHECK-DAG: <<RefArg:l\d+>> ParameterValue env_uses:[13,19,25] + /// CHECK-DAG: <<Array:l\d+>> ParameterValue env_uses:[13,19,25] + /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 env_uses:[25] + /// CHECK-DAG: SuspendCheck env:[[_,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:12 + /// CHECK-DAG: NullCheck env:[[<<Const0>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:18 + /// CHECK-DAG: Deoptimize env:[[<<Const0>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:24 + + /// CHECK-START-DEBUGGABLE: void Main.testDeoptimize(int, java.lang.Object, int[]) liveness (after) + /// CHECK-DAG: <<IntArg:i\d+>> ParameterValue env_uses:[13,19,25] + /// CHECK-DAG: <<RefArg:l\d+>> ParameterValue env_uses:[13,19,25] + /// CHECK-DAG: <<Array:l\d+>> ParameterValue env_uses:[13,19,25] + /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 env_uses:[19,25] + /// CHECK-DAG: SuspendCheck env:[[_,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:12 + /// CHECK-DAG: NullCheck env:[[<<Const0>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:18 + /// CHECK-DAG: Deoptimize env:[[<<Const0>>,<<IntArg>>,<<RefArg>>,<<Array>>]] liveness:24 + // + // A value that's not live in compiled code may still be needed in interpreter, + // due to code motion, etc. + public static void testDeoptimize(int x, Object y, int[] a) { + a[0] = x; + a[1] = x; + } + + /// CHECK-START: void Main.main(java.lang.String[]) liveness (after) /// CHECK: <<X:i\d+>> ArrayLength uses:[<<UseInput:\d+>>] /// CHECK: <<Y:i\d+>> StaticFieldGet uses:[<<UseInput>>] @@ -44,7 +120,15 @@ public class Main { if (x > y) { System.nanoTime(); } + + int val = 14; + int[] array = new int[2]; + Integer intObj = Integer.valueOf(0); + testThrowIntoCatchBlock(val, intObj, array); + testBoundsCheck(val, intObj, array); + testDeoptimize(val, intObj, array); } + public static int field = 42; } diff --git a/test/565-checker-rotate/build b/test/565-checker-rotate/build deleted file mode 100644 index 10ffcc537d..0000000000 --- a/test/565-checker-rotate/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/565-checker-rotate/smali/Main2.smali b/test/565-checker-rotate/smali/Main2.smali new file mode 100644 index 0000000000..ca5027e971 --- /dev/null +++ b/test/565-checker-rotate/smali/Main2.smali @@ -0,0 +1,165 @@ +# Copyright (C) 2016 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. + +.class public LMain2; +.super Ljava/lang/Object; + +## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) intrinsics_recognition (after) +## CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] +## CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<Val>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier (after) +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] +## CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] +## CHECK-DAG: <<Result:i\d+>> Ror [<<Val>>,<<NegDist>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier (after) +## CHECK-NOT: InvokeStaticOrDirect + +## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) select_generator (after) +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<SelVal:i\d+>> Select [<<Zero>>,<<One>>,<<ArgVal>>] +## CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] +## CHECK-DAG: <<Result:i\d+>> Ror [<<SelVal>>,<<NegDist>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) select_generator (after) +## CHECK-NOT: Phi + +## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier$after_bce (after) +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] +## CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateLeftBoolean(boolean, int) instruction_simplifier$after_bce (after) +## CHECK-NOT: Select + +# Original java source +# +# private static int rotateLeftBoolean(boolean value, int distance) { +# return Integer.rotateLeft(value ? 1 : 0, distance); +# } + +.method public static rotateLeftBoolean(ZI)I + .registers 3 + .param p0, "value" # Z + .param p1, "distance" # I + + .prologue + .line 66 + if-eqz p0, :cond_8 + + const/4 v0, 0x1 + + :goto_3 + invoke-static {v0, p1}, Ljava/lang/Integer;->rotateLeft(II)I + + move-result v0 + + return v0 + + :cond_8 + const/4 v0, 0x0 + + goto :goto_3 +.end method + +## CHECK-START: int Main2.rotateRightBoolean(boolean, int) intrinsics_recognition (after) +## CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] +## CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<Val>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier (after) +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] +## CHECK-DAG: <<Result:i\d+>> Ror [<<Val>>,<<ArgDist>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier (after) +## CHECK-NOT: InvokeStaticOrDirect + +## CHECK-START: int Main2.rotateRightBoolean(boolean, int) select_generator (after) +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<SelVal:i\d+>> Select [<<Zero>>,<<One>>,<<ArgVal>>] +## CHECK-DAG: <<Result:i\d+>> Ror [<<SelVal>>,<<ArgDist>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateRightBoolean(boolean, int) select_generator (after) +## CHECK-NOT: Phi + +## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier$after_bce (after) +## CHECK: <<ArgVal:z\d+>> ParameterValue +## CHECK: <<ArgDist:i\d+>> ParameterValue +## CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.rotateRightBoolean(boolean, int) instruction_simplifier$after_bce (after) +## CHECK-NOT: Select + +# Original java source: +# +# private static int rotateRightBoolean(boolean value, int distance) { +# return Integer.rotateRight(value ? 1 : 0, distance); +# } + +.method public static rotateRightBoolean(ZI)I + .registers 3 + .param p0, "value" # Z + .param p1, "distance" # I + + .prologue + .line 219 + if-eqz p0, :cond_8 + + const/4 v0, 0x1 + + :goto_3 + invoke-static {v0, p1}, Ljava/lang/Integer;->rotateRight(II)I + + move-result v0 + + return v0 + + :cond_8 + const/4 v0, 0x0 + + goto :goto_3 +.end method diff --git a/test/565-checker-rotate/src-art/Main.java b/test/565-checker-rotate/src-art/Main.java new file mode 100644 index 0000000000..b9e1315bd4 --- /dev/null +++ b/test/565-checker-rotate/src-art/Main.java @@ -0,0 +1,546 @@ +/* + * Copyright (C) 2016 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. + */ + +import java.lang.reflect.Method; + +public class Main { + + private static Class main2; + + /// CHECK-START: int Main.rotateLeftByte(byte, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:b\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftByte(byte, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:b\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftByte(byte, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateLeftByte(byte value, int distance) { + return Integer.rotateLeft(value, distance); + } + + /// CHECK-START: int Main.rotateLeftShort(short, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:s\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftShort(short, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:s\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftShort(short, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateLeftShort(short value, int distance) { + return Integer.rotateLeft(value, distance); + } + + /// CHECK-START: int Main.rotateLeftChar(char, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:c\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftChar(char, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:c\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftChar(char, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateLeftChar(char value, int distance) { + return Integer.rotateLeft(value, distance); + } + + /// CHECK-START: int Main.rotateLeftInt(int, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftInt(int, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftInt(int, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateLeftInt(int value, int distance) { + return Integer.rotateLeft(value, distance); + } + + /// CHECK-START: long Main.rotateLeftLong(long, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:j\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:j\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:LongRotateLeft + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: long Main.rotateLeftLong(long, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:j\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] + /// CHECK-DAG: <<Result:j\d+>> Ror [<<ArgVal>>,<<NegDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: long Main.rotateLeftLong(long, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static long rotateLeftLong(long value, int distance) { + return Long.rotateLeft(value, distance); + } + + /// CHECK-START: int Main.rotateRightByte(byte, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:b\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightByte(byte, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:b\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightByte(byte, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateRightByte(byte value, int distance) { + return Integer.rotateRight(value, distance); + } + + /// CHECK-START: int Main.rotateRightShort(short, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:s\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightShort(short, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:s\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightShort(short, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateRightShort(short value, int distance) { + return Integer.rotateRight(value, distance); + } + + /// CHECK-START: int Main.rotateRightChar(char, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:c\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightChar(char, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:c\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightChar(char, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateRightChar(char value, int distance) { + return Integer.rotateRight(value, distance); + } + + /// CHECK-START: int Main.rotateRightInt(int, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightInt(int, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightInt(int, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateRightInt(int value, int distance) { + return Integer.rotateRight(value, distance); + } + + /// CHECK-START: long Main.rotateRightLong(long, int) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:j\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:j\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:LongRotateRight + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: long Main.rotateRightLong(long, int) instruction_simplifier (after) + /// CHECK: <<ArgVal:j\d+>> ParameterValue + /// CHECK: <<ArgDist:i\d+>> ParameterValue + /// CHECK-DAG: <<Result:j\d+>> Ror [<<ArgVal>>,<<ArgDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: long Main.rotateRightLong(long, int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static long rotateRightLong(long value, int distance) { + return Long.rotateRight(value, distance); + } + + + /// CHECK-START: int Main.rotateLeftIntWithByteDistance(int, byte) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:b\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftIntWithByteDistance(int, byte) instruction_simplifier (after) + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:b\d+>> ParameterValue + /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateLeftIntWithByteDistance(int, byte) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateLeftIntWithByteDistance(int value, byte distance) { + return Integer.rotateLeft(value, distance); + } + + /// CHECK-START: int Main.rotateRightIntWithByteDistance(int, byte) intrinsics_recognition (after) + /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:b\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightIntWithByteDistance(int, byte) instruction_simplifier (after) + /// CHECK: <<ArgVal:i\d+>> ParameterValue + /// CHECK: <<ArgDist:b\d+>> ParameterValue + /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.rotateRightIntWithByteDistance(int, byte) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int rotateRightIntWithByteDistance(int value, byte distance) { + return Integer.rotateRight(value, distance); + } + + + public static void testRotateLeftBoolean() throws Exception { + Method rotateLeftBoolean = main2.getMethod("rotateLeftBoolean", boolean.class, int.class); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0, (int)rotateLeftBoolean.invoke(null, false, i)); + expectEqualsInt(1 << i, (int)rotateLeftBoolean.invoke(null, true, i)); + } + } + + public static void testRotateLeftByte() { + expectEqualsInt(0x00000001, rotateLeftByte((byte)0x01, 0)); + expectEqualsInt(0x00000002, rotateLeftByte((byte)0x01, 1)); + expectEqualsInt(0x80000000, rotateLeftByte((byte)0x01, 31)); + expectEqualsInt(0x00000001, rotateLeftByte((byte)0x01, 32)); // overshoot + expectEqualsInt(0xFFFFFF03, rotateLeftByte((byte)0x81, 1)); + expectEqualsInt(0xFFFFFE07, rotateLeftByte((byte)0x81, 2)); + expectEqualsInt(0x00000120, rotateLeftByte((byte)0x12, 4)); + expectEqualsInt(0xFFFF9AFF, rotateLeftByte((byte)0x9A, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateLeftByte((byte)0x0000, i)); + expectEqualsInt(0xFFFFFFFF, rotateLeftByte((byte)0xFFFF, i)); + expectEqualsInt((1 << j), rotateLeftByte((byte)0x0001, i)); + expectEqualsInt((0x12 << j) | (0x12 >>> -j), rotateLeftByte((byte)0x12, i)); + } + } + + public static void testRotateLeftShort() { + expectEqualsInt(0x00000001, rotateLeftShort((short)0x0001, 0)); + expectEqualsInt(0x00000002, rotateLeftShort((short)0x0001, 1)); + expectEqualsInt(0x80000000, rotateLeftShort((short)0x0001, 31)); + expectEqualsInt(0x00000001, rotateLeftShort((short)0x0001, 32)); // overshoot + expectEqualsInt(0xFFFF0003, rotateLeftShort((short)0x8001, 1)); + expectEqualsInt(0xFFFE0007, rotateLeftShort((short)0x8001, 2)); + expectEqualsInt(0x00012340, rotateLeftShort((short)0x1234, 4)); + expectEqualsInt(0xFF9ABCFF, rotateLeftShort((short)0x9ABC, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateLeftShort((short)0x0000, i)); + expectEqualsInt(0xFFFFFFFF, rotateLeftShort((short)0xFFFF, i)); + expectEqualsInt((1 << j), rotateLeftShort((short)0x0001, i)); + expectEqualsInt((0x1234 << j) | (0x1234 >>> -j), rotateLeftShort((short)0x1234, i)); + } + } + + public static void testRotateLeftChar() { + expectEqualsInt(0x00000001, rotateLeftChar((char)0x0001, 0)); + expectEqualsInt(0x00000002, rotateLeftChar((char)0x0001, 1)); + expectEqualsInt(0x80000000, rotateLeftChar((char)0x0001, 31)); + expectEqualsInt(0x00000001, rotateLeftChar((char)0x0001, 32)); // overshoot + expectEqualsInt(0x00010002, rotateLeftChar((char)0x8001, 1)); + expectEqualsInt(0x00020004, rotateLeftChar((char)0x8001, 2)); + expectEqualsInt(0x00012340, rotateLeftChar((char)0x1234, 4)); + expectEqualsInt(0x009ABC00, rotateLeftChar((char)0x9ABC, 8)); + expectEqualsInt(0x00FF0000, rotateLeftChar((char)0xFF00, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateLeftChar((char)0x0000, i)); + expectEqualsInt((1 << j), rotateLeftChar((char)0x0001, i)); + expectEqualsInt((0x1234 << j) | (0x1234 >>> -j), rotateLeftChar((char)0x1234, i)); + } + } + + public static void testRotateLeftInt() { + expectEqualsInt(0x00000001, rotateLeftInt(0x00000001, 0)); + expectEqualsInt(0x00000002, rotateLeftInt(0x00000001, 1)); + expectEqualsInt(0x80000000, rotateLeftInt(0x00000001, 31)); + expectEqualsInt(0x00000001, rotateLeftInt(0x00000001, 32)); // overshoot + expectEqualsInt(0x00000003, rotateLeftInt(0x80000001, 1)); + expectEqualsInt(0x00000006, rotateLeftInt(0x80000001, 2)); + expectEqualsInt(0x23456781, rotateLeftInt(0x12345678, 4)); + expectEqualsInt(0xBCDEF09A, rotateLeftInt(0x9ABCDEF0, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateLeftInt(0x00000000, i)); + expectEqualsInt(0xFFFFFFFF, rotateLeftInt(0xFFFFFFFF, i)); + expectEqualsInt(1 << j, rotateLeftInt(0x00000001, i)); + expectEqualsInt((0x12345678 << j) | (0x12345678 >>> -j), rotateLeftInt(0x12345678, i)); + } + } + + public static void testRotateLeftLong() { + expectEqualsLong(0x0000000000000001L, rotateLeftLong(0x0000000000000001L, 0)); + expectEqualsLong(0x0000000000000002L, rotateLeftLong(0x0000000000000001L, 1)); + expectEqualsLong(0x8000000000000000L, rotateLeftLong(0x0000000000000001L, 63)); + expectEqualsLong(0x0000000000000001L, rotateLeftLong(0x0000000000000001L, 64)); // overshoot + expectEqualsLong(0x0000000000000003L, rotateLeftLong(0x8000000000000001L, 1)); + expectEqualsLong(0x0000000000000006L, rotateLeftLong(0x8000000000000001L, 2)); + expectEqualsLong(0x23456789ABCDEF01L, rotateLeftLong(0x123456789ABCDEF0L, 4)); + expectEqualsLong(0x3456789ABCDEF012L, rotateLeftLong(0x123456789ABCDEF0L, 8)); + for (int i = 0; i < 70; i++) { // overshoot a bit + int j = i & 63; + expectEqualsLong(0x0000000000000000L, rotateLeftLong(0x0000000000000000L, i)); + expectEqualsLong(0xFFFFFFFFFFFFFFFFL, rotateLeftLong(0xFFFFFFFFFFFFFFFFL, i)); + expectEqualsLong(1L << j, rotateLeftLong(0x0000000000000001, i)); + expectEqualsLong((0x123456789ABCDEF0L << j) | (0x123456789ABCDEF0L >>> -j), + rotateLeftLong(0x123456789ABCDEF0L, i)); + } + } + + public static void testRotateRightBoolean() throws Exception { + Method rotateRightBoolean = main2.getMethod("rotateRightBoolean", boolean.class, int.class); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0, (int)rotateRightBoolean.invoke(null, false, i)); + expectEqualsInt(1 << (32 - i), (int)rotateRightBoolean.invoke(null, true, i)); + } + } + + public static void testRotateRightByte() { + expectEqualsInt(0xFFFFFF80, rotateRightByte((byte)0x80, 0)); + expectEqualsInt(0x7FFFFFC0, rotateRightByte((byte)0x80, 1)); + expectEqualsInt(0xFFFFFF01, rotateRightByte((byte)0x80, 31)); + expectEqualsInt(0xFFFFFF80, rotateRightByte((byte)0x80, 32)); // overshoot + expectEqualsInt(0xFFFFFFC0, rotateRightByte((byte)0x81, 1)); + expectEqualsInt(0x7FFFFFE0, rotateRightByte((byte)0x81, 2)); + expectEqualsInt(0x20000001, rotateRightByte((byte)0x12, 4)); + expectEqualsInt(0x9AFFFFFF, rotateRightByte((byte)0x9A, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateRightByte((byte)0x00, i)); + expectEqualsInt(0xFFFFFFFF, rotateRightByte((byte)0xFF, i)); + expectEqualsInt(1 << (32 - j), rotateRightByte((byte)0x01, i)); + expectEqualsInt((0x12 >>> j) | (0x12 << -j), rotateRightByte((byte)0x12, i)); + } + } + + public static void testRotateRightShort() { + expectEqualsInt(0xFFFF8000, rotateRightShort((short)0x8000, 0)); + expectEqualsInt(0x7FFFC000, rotateRightShort((short)0x8000, 1)); + expectEqualsInt(0xFFFF0001, rotateRightShort((short)0x8000, 31)); + expectEqualsInt(0xFFFF8000, rotateRightShort((short)0x8000, 32)); // overshoot + expectEqualsInt(0xFFFFC000, rotateRightShort((short)0x8001, 1)); + expectEqualsInt(0x7FFFE000, rotateRightShort((short)0x8001, 2)); + expectEqualsInt(0x40000123, rotateRightShort((short)0x1234, 4)); + expectEqualsInt(0xBCFFFF9A, rotateRightShort((short)0x9ABC, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateRightShort((short)0x0000, i)); + expectEqualsInt(0xFFFFFFFF, rotateRightShort((short)0xFFFF, i)); + expectEqualsInt(1 << (32 - j), rotateRightShort((short)0x0001, i)); + expectEqualsInt((0x1234 >>> j) | (0x1234 << -j), rotateRightShort((short)0x1234, i)); + } + } + + public static void testRotateRightChar() { + expectEqualsInt(0x00008000, rotateRightChar((char)0x8000, 0)); + expectEqualsInt(0x00004000, rotateRightChar((char)0x8000, 1)); + expectEqualsInt(0x00010000, rotateRightChar((char)0x8000, 31)); + expectEqualsInt(0x00008000, rotateRightChar((char)0x8000, 32)); // overshoot + expectEqualsInt(0x80004000, rotateRightChar((char)0x8001, 1)); + expectEqualsInt(0x40002000, rotateRightChar((char)0x8001, 2)); + expectEqualsInt(0x40000123, rotateRightChar((char)0x1234, 4)); + expectEqualsInt(0xBC00009A, rotateRightChar((char)0x9ABC, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateRightChar((char)0x0000, i)); + expectEqualsInt(1 << (32 - j), rotateRightChar((char)0x0001, i)); + expectEqualsInt((0x1234 >>> j) | (0x1234 << -j), rotateRightChar((char)0x1234, i)); + } + } + + public static void testRotateRightInt() { + expectEqualsInt(0x80000000, rotateRightInt(0x80000000, 0)); + expectEqualsInt(0x40000000, rotateRightInt(0x80000000, 1)); + expectEqualsInt(0x00000001, rotateRightInt(0x80000000, 31)); + expectEqualsInt(0x80000000, rotateRightInt(0x80000000, 32)); // overshoot + expectEqualsInt(0xC0000000, rotateRightInt(0x80000001, 1)); + expectEqualsInt(0x60000000, rotateRightInt(0x80000001, 2)); + expectEqualsInt(0x81234567, rotateRightInt(0x12345678, 4)); + expectEqualsInt(0xF09ABCDE, rotateRightInt(0x9ABCDEF0, 8)); + for (int i = 0; i < 40; i++) { // overshoot a bit + int j = i & 31; + expectEqualsInt(0x00000000, rotateRightInt(0x00000000, i)); + expectEqualsInt(0xFFFFFFFF, rotateRightInt(0xFFFFFFFF, i)); + expectEqualsInt(0x80000000 >>> j, rotateRightInt(0x80000000, i)); + expectEqualsInt((0x12345678 >>> j) | (0x12345678 << -j), rotateRightInt(0x12345678, i)); + } + } + + public static void testRotateRightLong() { + expectEqualsLong(0x8000000000000000L, rotateRightLong(0x8000000000000000L, 0)); + expectEqualsLong(0x4000000000000000L, rotateRightLong(0x8000000000000000L, 1)); + expectEqualsLong(0x0000000000000001L, rotateRightLong(0x8000000000000000L, 63)); + expectEqualsLong(0x8000000000000000L, rotateRightLong(0x8000000000000000L, 64)); // overshoot + expectEqualsLong(0xC000000000000000L, rotateRightLong(0x8000000000000001L, 1)); + expectEqualsLong(0x6000000000000000L, rotateRightLong(0x8000000000000001L, 2)); + expectEqualsLong(0x0123456789ABCDEFL, rotateRightLong(0x123456789ABCDEF0L, 4)); + expectEqualsLong(0xF0123456789ABCDEL, rotateRightLong(0x123456789ABCDEF0L, 8)); + for (int i = 0; i < 70; i++) { // overshoot a bit + int j = i & 63; + expectEqualsLong(0x0000000000000000L, rotateRightLong(0x0000000000000000L, i)); + expectEqualsLong(0xFFFFFFFFFFFFFFFFL, rotateRightLong(0xFFFFFFFFFFFFFFFFL, i)); + expectEqualsLong(0x8000000000000000L >>> j, rotateRightLong(0x8000000000000000L, i)); + expectEqualsLong((0x123456789ABCDEF0L >>> j) | (0x123456789ABCDEF0L << -j), + rotateRightLong(0x123456789ABCDEF0L, i)); + } + } + + + public static void testRotateLeftIntWithByteDistance() { + expectEqualsInt(0x00000001, rotateLeftIntWithByteDistance(0x00000001, (byte)0)); + expectEqualsInt(0x00000002, rotateLeftIntWithByteDistance(0x00000001, (byte)1)); + expectEqualsInt(0x80000000, rotateLeftIntWithByteDistance(0x00000001, (byte)31)); + expectEqualsInt(0x00000001, rotateLeftIntWithByteDistance(0x00000001, (byte)32)); // overshoot + expectEqualsInt(0x00000003, rotateLeftIntWithByteDistance(0x80000001, (byte)1)); + expectEqualsInt(0x00000006, rotateLeftIntWithByteDistance(0x80000001, (byte)2)); + expectEqualsInt(0x23456781, rotateLeftIntWithByteDistance(0x12345678, (byte)4)); + expectEqualsInt(0xBCDEF09A, rotateLeftIntWithByteDistance(0x9ABCDEF0, (byte)8)); + for (byte i = 0; i < 40; i++) { // overshoot a bit + byte j = (byte)(i & 31); + expectEqualsInt(0x00000000, rotateLeftIntWithByteDistance(0x00000000, i)); + expectEqualsInt(0xFFFFFFFF, rotateLeftIntWithByteDistance(0xFFFFFFFF, i)); + expectEqualsInt(1 << j, rotateLeftIntWithByteDistance(0x00000001, i)); + expectEqualsInt((0x12345678 << j) | (0x12345678 >>> -j), + rotateLeftIntWithByteDistance(0x12345678, i)); + } + } + + public static void testRotateRightIntWithByteDistance() { + expectEqualsInt(0x80000000, rotateRightIntWithByteDistance(0x80000000, (byte)0)); + expectEqualsInt(0x40000000, rotateRightIntWithByteDistance(0x80000000, (byte)1)); + expectEqualsInt(0x00000001, rotateRightIntWithByteDistance(0x80000000, (byte)31)); + expectEqualsInt(0x80000000, rotateRightIntWithByteDistance(0x80000000, (byte)32)); // overshoot + expectEqualsInt(0xC0000000, rotateRightIntWithByteDistance(0x80000001, (byte)1)); + expectEqualsInt(0x60000000, rotateRightIntWithByteDistance(0x80000001, (byte)2)); + expectEqualsInt(0x81234567, rotateRightIntWithByteDistance(0x12345678, (byte)4)); + expectEqualsInt(0xF09ABCDE, rotateRightIntWithByteDistance(0x9ABCDEF0, (byte)8)); + for (byte i = 0; i < 40; i++) { // overshoot a bit + byte j = (byte)(i & 31); + expectEqualsInt(0x00000000, rotateRightIntWithByteDistance(0x00000000, i)); + expectEqualsInt(0xFFFFFFFF, rotateRightIntWithByteDistance(0xFFFFFFFF, i)); + expectEqualsInt(0x80000000 >>> j, rotateRightIntWithByteDistance(0x80000000, i)); + expectEqualsInt((0x12345678 >>> j) | (0x12345678 << -j), + rotateRightIntWithByteDistance(0x12345678, i)); + } + } + + + public static void main(String args[]) throws Exception { + main2 = Class.forName("Main2"); + + testRotateLeftBoolean(); + testRotateLeftByte(); + testRotateLeftShort(); + testRotateLeftChar(); + testRotateLeftInt(); + testRotateLeftLong(); + + testRotateRightBoolean(); + testRotateRightByte(); + testRotateRightShort(); + testRotateRightChar(); + testRotateRightInt(); + testRotateRightLong(); + + // Also exercise distance values with types other than int. + testRotateLeftIntWithByteDistance(); + testRotateRightIntWithByteDistance(); + + System.out.println("passed"); + } + + + private static void expectEqualsInt(int expected, int result) { + if (expected != result) { + throw new Error("Expected: " + expected + ", found: " + result); + } + } + + private static void expectEqualsLong(long expected, long result) { + if (expected != result) { + throw new Error("Expected: " + expected + ", found: " + result); + } + } +} diff --git a/test/565-checker-rotate/src/Main.java b/test/565-checker-rotate/src/Main.java index eb0e8688c0..79b8555878 100644 --- a/test/565-checker-rotate/src/Main.java +++ b/test/565-checker-rotate/src/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,623 +14,9 @@ * limitations under the License. */ +// This file is just for running on the RI as the test is ART specific. public class Main { - - /// CHECK-START: int Main.rotateLeftBoolean(boolean, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<Val>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftBoolean(boolean, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<Val>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftBoolean(boolean, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - /// CHECK-START: int Main.rotateLeftBoolean(boolean, int) select_generator (after) - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<SelVal:i\d+>> Select [<<Zero>>,<<One>>,<<ArgVal>>] - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<SelVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftBoolean(boolean, int) select_generator (after) - /// CHECK-NOT: Phi - - /// CHECK-START: int Main.rotateLeftBoolean(boolean, int) instruction_simplifier$after_bce (after) - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftBoolean(boolean, int) instruction_simplifier$after_bce (after) - /// CHECK-NOT: Select - - private static int rotateLeftBoolean(boolean value, int distance) { - return Integer.rotateLeft(value ? 1 : 0, distance); - } - - /// CHECK-START: int Main.rotateLeftByte(byte, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:b\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftByte(byte, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:b\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftByte(byte, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateLeftByte(byte value, int distance) { - return Integer.rotateLeft(value, distance); - } - - /// CHECK-START: int Main.rotateLeftShort(short, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:s\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftShort(short, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:s\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftShort(short, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateLeftShort(short value, int distance) { - return Integer.rotateLeft(value, distance); - } - - /// CHECK-START: int Main.rotateLeftChar(char, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:c\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftChar(char, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:c\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftChar(char, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateLeftChar(char value, int distance) { - return Integer.rotateLeft(value, distance); - } - - /// CHECK-START: int Main.rotateLeftInt(int, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftInt(int, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftInt(int, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateLeftInt(int value, int distance) { - return Integer.rotateLeft(value, distance); - } - - /// CHECK-START: long Main.rotateLeftLong(long, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:j\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:j\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:LongRotateLeft - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: long Main.rotateLeftLong(long, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:j\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:j\d+>> Ror [<<ArgVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: long Main.rotateLeftLong(long, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static long rotateLeftLong(long value, int distance) { - return Long.rotateLeft(value, distance); - } - - - /// CHECK-START: int Main.rotateRightBoolean(boolean, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<Val>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightBoolean(boolean, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Val:i\d+>> Phi [<<One>>,<<Zero>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<Val>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightBoolean(boolean, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - /// CHECK-START: int Main.rotateRightBoolean(boolean, int) select_generator (after) - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<SelVal:i\d+>> Select [<<Zero>>,<<One>>,<<ArgVal>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<SelVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightBoolean(boolean, int) select_generator (after) - /// CHECK-NOT: Phi - - /// CHECK-START: int Main.rotateRightBoolean(boolean, int) instruction_simplifier$after_bce (after) - /// CHECK: <<ArgVal:z\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightBoolean(boolean, int) instruction_simplifier$after_bce (after) - /// CHECK-NOT: Select - - private static int rotateRightBoolean(boolean value, int distance) { - return Integer.rotateRight(value ? 1 : 0, distance); - } - - /// CHECK-START: int Main.rotateRightByte(byte, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:b\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightByte(byte, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:b\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightByte(byte, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateRightByte(byte value, int distance) { - return Integer.rotateRight(value, distance); - } - - /// CHECK-START: int Main.rotateRightShort(short, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:s\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightShort(short, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:s\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightShort(short, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateRightShort(short value, int distance) { - return Integer.rotateRight(value, distance); - } - - /// CHECK-START: int Main.rotateRightChar(char, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:c\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightChar(char, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:c\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightChar(char, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateRightChar(char value, int distance) { - return Integer.rotateRight(value, distance); - } - - /// CHECK-START: int Main.rotateRightInt(int, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightInt(int, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightInt(int, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateRightInt(int value, int distance) { - return Integer.rotateRight(value, distance); - } - - /// CHECK-START: long Main.rotateRightLong(long, int) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:j\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:j\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:LongRotateRight - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: long Main.rotateRightLong(long, int) instruction_simplifier (after) - /// CHECK: <<ArgVal:j\d+>> ParameterValue - /// CHECK: <<ArgDist:i\d+>> ParameterValue - /// CHECK-DAG: <<Result:j\d+>> Ror [<<ArgVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: long Main.rotateRightLong(long, int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static long rotateRightLong(long value, int distance) { - return Long.rotateRight(value, distance); - } - - - /// CHECK-START: int Main.rotateLeftIntWithByteDistance(int, byte) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:b\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateLeft - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftIntWithByteDistance(int, byte) instruction_simplifier (after) - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:b\d+>> ParameterValue - /// CHECK-DAG: <<NegDist:i\d+>> Neg [<<ArgDist>>] - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<NegDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateLeftIntWithByteDistance(int, byte) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateLeftIntWithByteDistance(int value, byte distance) { - return Integer.rotateLeft(value, distance); - } - - /// CHECK-START: int Main.rotateRightIntWithByteDistance(int, byte) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:b\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<ArgVal>>,<<ArgDist>>,<<Method>>] intrinsic:IntegerRotateRight - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightIntWithByteDistance(int, byte) instruction_simplifier (after) - /// CHECK: <<ArgVal:i\d+>> ParameterValue - /// CHECK: <<ArgDist:b\d+>> ParameterValue - /// CHECK-DAG: <<Result:i\d+>> Ror [<<ArgVal>>,<<ArgDist>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.rotateRightIntWithByteDistance(int, byte) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int rotateRightIntWithByteDistance(int value, byte distance) { - return Integer.rotateRight(value, distance); - } - - - public static void testRotateLeftBoolean() { - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0, rotateLeftBoolean(false, i)); - expectEqualsInt(1 << i, rotateLeftBoolean(true, i)); - } - } - - public static void testRotateLeftByte() { - expectEqualsInt(0x00000001, rotateLeftByte((byte)0x01, 0)); - expectEqualsInt(0x00000002, rotateLeftByte((byte)0x01, 1)); - expectEqualsInt(0x80000000, rotateLeftByte((byte)0x01, 31)); - expectEqualsInt(0x00000001, rotateLeftByte((byte)0x01, 32)); // overshoot - expectEqualsInt(0xFFFFFF03, rotateLeftByte((byte)0x81, 1)); - expectEqualsInt(0xFFFFFE07, rotateLeftByte((byte)0x81, 2)); - expectEqualsInt(0x00000120, rotateLeftByte((byte)0x12, 4)); - expectEqualsInt(0xFFFF9AFF, rotateLeftByte((byte)0x9A, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateLeftByte((byte)0x0000, i)); - expectEqualsInt(0xFFFFFFFF, rotateLeftByte((byte)0xFFFF, i)); - expectEqualsInt((1 << j), rotateLeftByte((byte)0x0001, i)); - expectEqualsInt((0x12 << j) | (0x12 >>> -j), rotateLeftByte((byte)0x12, i)); - } - } - - public static void testRotateLeftShort() { - expectEqualsInt(0x00000001, rotateLeftShort((short)0x0001, 0)); - expectEqualsInt(0x00000002, rotateLeftShort((short)0x0001, 1)); - expectEqualsInt(0x80000000, rotateLeftShort((short)0x0001, 31)); - expectEqualsInt(0x00000001, rotateLeftShort((short)0x0001, 32)); // overshoot - expectEqualsInt(0xFFFF0003, rotateLeftShort((short)0x8001, 1)); - expectEqualsInt(0xFFFE0007, rotateLeftShort((short)0x8001, 2)); - expectEqualsInt(0x00012340, rotateLeftShort((short)0x1234, 4)); - expectEqualsInt(0xFF9ABCFF, rotateLeftShort((short)0x9ABC, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateLeftShort((short)0x0000, i)); - expectEqualsInt(0xFFFFFFFF, rotateLeftShort((short)0xFFFF, i)); - expectEqualsInt((1 << j), rotateLeftShort((short)0x0001, i)); - expectEqualsInt((0x1234 << j) | (0x1234 >>> -j), rotateLeftShort((short)0x1234, i)); - } - } - - public static void testRotateLeftChar() { - expectEqualsInt(0x00000001, rotateLeftChar((char)0x0001, 0)); - expectEqualsInt(0x00000002, rotateLeftChar((char)0x0001, 1)); - expectEqualsInt(0x80000000, rotateLeftChar((char)0x0001, 31)); - expectEqualsInt(0x00000001, rotateLeftChar((char)0x0001, 32)); // overshoot - expectEqualsInt(0x00010002, rotateLeftChar((char)0x8001, 1)); - expectEqualsInt(0x00020004, rotateLeftChar((char)0x8001, 2)); - expectEqualsInt(0x00012340, rotateLeftChar((char)0x1234, 4)); - expectEqualsInt(0x009ABC00, rotateLeftChar((char)0x9ABC, 8)); - expectEqualsInt(0x00FF0000, rotateLeftChar((char)0xFF00, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateLeftChar((char)0x0000, i)); - expectEqualsInt((1 << j), rotateLeftChar((char)0x0001, i)); - expectEqualsInt((0x1234 << j) | (0x1234 >>> -j), rotateLeftChar((char)0x1234, i)); - } - } - - public static void testRotateLeftInt() { - expectEqualsInt(0x00000001, rotateLeftInt(0x00000001, 0)); - expectEqualsInt(0x00000002, rotateLeftInt(0x00000001, 1)); - expectEqualsInt(0x80000000, rotateLeftInt(0x00000001, 31)); - expectEqualsInt(0x00000001, rotateLeftInt(0x00000001, 32)); // overshoot - expectEqualsInt(0x00000003, rotateLeftInt(0x80000001, 1)); - expectEqualsInt(0x00000006, rotateLeftInt(0x80000001, 2)); - expectEqualsInt(0x23456781, rotateLeftInt(0x12345678, 4)); - expectEqualsInt(0xBCDEF09A, rotateLeftInt(0x9ABCDEF0, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateLeftInt(0x00000000, i)); - expectEqualsInt(0xFFFFFFFF, rotateLeftInt(0xFFFFFFFF, i)); - expectEqualsInt(1 << j, rotateLeftInt(0x00000001, i)); - expectEqualsInt((0x12345678 << j) | (0x12345678 >>> -j), rotateLeftInt(0x12345678, i)); - } - } - - public static void testRotateLeftLong() { - expectEqualsLong(0x0000000000000001L, rotateLeftLong(0x0000000000000001L, 0)); - expectEqualsLong(0x0000000000000002L, rotateLeftLong(0x0000000000000001L, 1)); - expectEqualsLong(0x8000000000000000L, rotateLeftLong(0x0000000000000001L, 63)); - expectEqualsLong(0x0000000000000001L, rotateLeftLong(0x0000000000000001L, 64)); // overshoot - expectEqualsLong(0x0000000000000003L, rotateLeftLong(0x8000000000000001L, 1)); - expectEqualsLong(0x0000000000000006L, rotateLeftLong(0x8000000000000001L, 2)); - expectEqualsLong(0x23456789ABCDEF01L, rotateLeftLong(0x123456789ABCDEF0L, 4)); - expectEqualsLong(0x3456789ABCDEF012L, rotateLeftLong(0x123456789ABCDEF0L, 8)); - for (int i = 0; i < 70; i++) { // overshoot a bit - int j = i & 63; - expectEqualsLong(0x0000000000000000L, rotateLeftLong(0x0000000000000000L, i)); - expectEqualsLong(0xFFFFFFFFFFFFFFFFL, rotateLeftLong(0xFFFFFFFFFFFFFFFFL, i)); - expectEqualsLong(1L << j, rotateLeftLong(0x0000000000000001, i)); - expectEqualsLong((0x123456789ABCDEF0L << j) | (0x123456789ABCDEF0L >>> -j), - rotateLeftLong(0x123456789ABCDEF0L, i)); - } - } - - public static void testRotateRightBoolean() { - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0, rotateRightBoolean(false, i)); - expectEqualsInt(1 << (32 - i), rotateRightBoolean(true, i)); - } - } - - public static void testRotateRightByte() { - expectEqualsInt(0xFFFFFF80, rotateRightByte((byte)0x80, 0)); - expectEqualsInt(0x7FFFFFC0, rotateRightByte((byte)0x80, 1)); - expectEqualsInt(0xFFFFFF01, rotateRightByte((byte)0x80, 31)); - expectEqualsInt(0xFFFFFF80, rotateRightByte((byte)0x80, 32)); // overshoot - expectEqualsInt(0xFFFFFFC0, rotateRightByte((byte)0x81, 1)); - expectEqualsInt(0x7FFFFFE0, rotateRightByte((byte)0x81, 2)); - expectEqualsInt(0x20000001, rotateRightByte((byte)0x12, 4)); - expectEqualsInt(0x9AFFFFFF, rotateRightByte((byte)0x9A, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateRightByte((byte)0x00, i)); - expectEqualsInt(0xFFFFFFFF, rotateRightByte((byte)0xFF, i)); - expectEqualsInt(1 << (32 - j), rotateRightByte((byte)0x01, i)); - expectEqualsInt((0x12 >>> j) | (0x12 << -j), rotateRightByte((byte)0x12, i)); - } - } - - public static void testRotateRightShort() { - expectEqualsInt(0xFFFF8000, rotateRightShort((short)0x8000, 0)); - expectEqualsInt(0x7FFFC000, rotateRightShort((short)0x8000, 1)); - expectEqualsInt(0xFFFF0001, rotateRightShort((short)0x8000, 31)); - expectEqualsInt(0xFFFF8000, rotateRightShort((short)0x8000, 32)); // overshoot - expectEqualsInt(0xFFFFC000, rotateRightShort((short)0x8001, 1)); - expectEqualsInt(0x7FFFE000, rotateRightShort((short)0x8001, 2)); - expectEqualsInt(0x40000123, rotateRightShort((short)0x1234, 4)); - expectEqualsInt(0xBCFFFF9A, rotateRightShort((short)0x9ABC, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateRightShort((short)0x0000, i)); - expectEqualsInt(0xFFFFFFFF, rotateRightShort((short)0xFFFF, i)); - expectEqualsInt(1 << (32 - j), rotateRightShort((short)0x0001, i)); - expectEqualsInt((0x1234 >>> j) | (0x1234 << -j), rotateRightShort((short)0x1234, i)); - } - } - - public static void testRotateRightChar() { - expectEqualsInt(0x00008000, rotateRightChar((char)0x8000, 0)); - expectEqualsInt(0x00004000, rotateRightChar((char)0x8000, 1)); - expectEqualsInt(0x00010000, rotateRightChar((char)0x8000, 31)); - expectEqualsInt(0x00008000, rotateRightChar((char)0x8000, 32)); // overshoot - expectEqualsInt(0x80004000, rotateRightChar((char)0x8001, 1)); - expectEqualsInt(0x40002000, rotateRightChar((char)0x8001, 2)); - expectEqualsInt(0x40000123, rotateRightChar((char)0x1234, 4)); - expectEqualsInt(0xBC00009A, rotateRightChar((char)0x9ABC, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateRightChar((char)0x0000, i)); - expectEqualsInt(1 << (32 - j), rotateRightChar((char)0x0001, i)); - expectEqualsInt((0x1234 >>> j) | (0x1234 << -j), rotateRightChar((char)0x1234, i)); - } - } - - public static void testRotateRightInt() { - expectEqualsInt(0x80000000, rotateRightInt(0x80000000, 0)); - expectEqualsInt(0x40000000, rotateRightInt(0x80000000, 1)); - expectEqualsInt(0x00000001, rotateRightInt(0x80000000, 31)); - expectEqualsInt(0x80000000, rotateRightInt(0x80000000, 32)); // overshoot - expectEqualsInt(0xC0000000, rotateRightInt(0x80000001, 1)); - expectEqualsInt(0x60000000, rotateRightInt(0x80000001, 2)); - expectEqualsInt(0x81234567, rotateRightInt(0x12345678, 4)); - expectEqualsInt(0xF09ABCDE, rotateRightInt(0x9ABCDEF0, 8)); - for (int i = 0; i < 40; i++) { // overshoot a bit - int j = i & 31; - expectEqualsInt(0x00000000, rotateRightInt(0x00000000, i)); - expectEqualsInt(0xFFFFFFFF, rotateRightInt(0xFFFFFFFF, i)); - expectEqualsInt(0x80000000 >>> j, rotateRightInt(0x80000000, i)); - expectEqualsInt((0x12345678 >>> j) | (0x12345678 << -j), rotateRightInt(0x12345678, i)); - } - } - - public static void testRotateRightLong() { - expectEqualsLong(0x8000000000000000L, rotateRightLong(0x8000000000000000L, 0)); - expectEqualsLong(0x4000000000000000L, rotateRightLong(0x8000000000000000L, 1)); - expectEqualsLong(0x0000000000000001L, rotateRightLong(0x8000000000000000L, 63)); - expectEqualsLong(0x8000000000000000L, rotateRightLong(0x8000000000000000L, 64)); // overshoot - expectEqualsLong(0xC000000000000000L, rotateRightLong(0x8000000000000001L, 1)); - expectEqualsLong(0x6000000000000000L, rotateRightLong(0x8000000000000001L, 2)); - expectEqualsLong(0x0123456789ABCDEFL, rotateRightLong(0x123456789ABCDEF0L, 4)); - expectEqualsLong(0xF0123456789ABCDEL, rotateRightLong(0x123456789ABCDEF0L, 8)); - for (int i = 0; i < 70; i++) { // overshoot a bit - int j = i & 63; - expectEqualsLong(0x0000000000000000L, rotateRightLong(0x0000000000000000L, i)); - expectEqualsLong(0xFFFFFFFFFFFFFFFFL, rotateRightLong(0xFFFFFFFFFFFFFFFFL, i)); - expectEqualsLong(0x8000000000000000L >>> j, rotateRightLong(0x8000000000000000L, i)); - expectEqualsLong((0x123456789ABCDEF0L >>> j) | (0x123456789ABCDEF0L << -j), - rotateRightLong(0x123456789ABCDEF0L, i)); - } - } - - - public static void testRotateLeftIntWithByteDistance() { - expectEqualsInt(0x00000001, rotateLeftIntWithByteDistance(0x00000001, (byte)0)); - expectEqualsInt(0x00000002, rotateLeftIntWithByteDistance(0x00000001, (byte)1)); - expectEqualsInt(0x80000000, rotateLeftIntWithByteDistance(0x00000001, (byte)31)); - expectEqualsInt(0x00000001, rotateLeftIntWithByteDistance(0x00000001, (byte)32)); // overshoot - expectEqualsInt(0x00000003, rotateLeftIntWithByteDistance(0x80000001, (byte)1)); - expectEqualsInt(0x00000006, rotateLeftIntWithByteDistance(0x80000001, (byte)2)); - expectEqualsInt(0x23456781, rotateLeftIntWithByteDistance(0x12345678, (byte)4)); - expectEqualsInt(0xBCDEF09A, rotateLeftIntWithByteDistance(0x9ABCDEF0, (byte)8)); - for (byte i = 0; i < 40; i++) { // overshoot a bit - byte j = (byte)(i & 31); - expectEqualsInt(0x00000000, rotateLeftIntWithByteDistance(0x00000000, i)); - expectEqualsInt(0xFFFFFFFF, rotateLeftIntWithByteDistance(0xFFFFFFFF, i)); - expectEqualsInt(1 << j, rotateLeftIntWithByteDistance(0x00000001, i)); - expectEqualsInt((0x12345678 << j) | (0x12345678 >>> -j), - rotateLeftIntWithByteDistance(0x12345678, i)); - } - } - - public static void testRotateRightIntWithByteDistance() { - expectEqualsInt(0x80000000, rotateRightIntWithByteDistance(0x80000000, (byte)0)); - expectEqualsInt(0x40000000, rotateRightIntWithByteDistance(0x80000000, (byte)1)); - expectEqualsInt(0x00000001, rotateRightIntWithByteDistance(0x80000000, (byte)31)); - expectEqualsInt(0x80000000, rotateRightIntWithByteDistance(0x80000000, (byte)32)); // overshoot - expectEqualsInt(0xC0000000, rotateRightIntWithByteDistance(0x80000001, (byte)1)); - expectEqualsInt(0x60000000, rotateRightIntWithByteDistance(0x80000001, (byte)2)); - expectEqualsInt(0x81234567, rotateRightIntWithByteDistance(0x12345678, (byte)4)); - expectEqualsInt(0xF09ABCDE, rotateRightIntWithByteDistance(0x9ABCDEF0, (byte)8)); - for (byte i = 0; i < 40; i++) { // overshoot a bit - byte j = (byte)(i & 31); - expectEqualsInt(0x00000000, rotateRightIntWithByteDistance(0x00000000, i)); - expectEqualsInt(0xFFFFFFFF, rotateRightIntWithByteDistance(0xFFFFFFFF, i)); - expectEqualsInt(0x80000000 >>> j, rotateRightIntWithByteDistance(0x80000000, i)); - expectEqualsInt((0x12345678 >>> j) | (0x12345678 << -j), - rotateRightIntWithByteDistance(0x12345678, i)); - } - } - - public static void main(String args[]) { - testRotateLeftBoolean(); - testRotateLeftByte(); - testRotateLeftShort(); - testRotateLeftChar(); - testRotateLeftInt(); - testRotateLeftLong(); - - testRotateRightBoolean(); - testRotateRightByte(); - testRotateRightShort(); - testRotateRightChar(); - testRotateRightInt(); - testRotateRightLong(); - - // Also exercise distance values with types other than int. - testRotateLeftIntWithByteDistance(); - testRotateRightIntWithByteDistance(); - System.out.println("passed"); } - - - private static void expectEqualsInt(int expected, int result) { - if (expected != result) { - throw new Error("Expected: " + expected + ", found: " + result); - } - } - - private static void expectEqualsLong(long expected, long result) { - if (expected != result) { - throw new Error("Expected: " + expected + ", found: " + result); - } - } -} +}
\ No newline at end of file diff --git a/test/566-checker-signum/build b/test/566-checker-signum/build deleted file mode 100644 index 10ffcc537d..0000000000 --- a/test/566-checker-signum/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/566-checker-signum/smali/Main2.smali b/test/566-checker-signum/smali/Main2.smali new file mode 100644 index 0000000000..d99ad8662b --- /dev/null +++ b/test/566-checker-signum/smali/Main2.smali @@ -0,0 +1,83 @@ +# Copyright (C) 2016 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. + +.class public LMain2; +.super Ljava/lang/Object; + +## CHECK-START: int Main2.signBoolean(boolean) intrinsics_recognition (after) +## CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<Phi:i\d+>> Phi [<<One>>,<<Zero>>] +## CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<Phi>>,<<Method>>] intrinsic:IntegerSignum +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.signBoolean(boolean) instruction_simplifier (after) +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<Phi:i\d+>> Phi [<<One>>,<<Zero>>] +## CHECK-DAG: <<Result:i\d+>> Compare [<<Phi>>,<<Zero>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.signBoolean(boolean) instruction_simplifier (after) +## CHECK-NOT: InvokeStaticOrDirect + +## CHECK-START: int Main2.signBoolean(boolean) select_generator (after) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<One:i\d+>> IntConstant 1 +## CHECK-DAG: <<Sel:i\d+>> Select [<<Zero>>,<<One>>,<<Arg>>] +## CHECK-DAG: <<Result:i\d+>> Compare [<<Sel>>,<<Zero>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.signBoolean(boolean) select_generator (after) +## CHECK-NOT: Phi + +## CHECK-START: int Main2.signBoolean(boolean) instruction_simplifier$after_bce (after) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: <<Zero:i\d+>> IntConstant 0 +## CHECK-DAG: <<Result:i\d+>> Compare [<<Arg>>,<<Zero>>] +## CHECK-DAG: Return [<<Result>>] + +## CHECK-START: int Main2.signBoolean(boolean) instruction_simplifier$after_bce (after) +## CHECK-NOT: Select + +# Original java source: +# +# private static int signBoolean(boolean x) { +# return Integer.signum(x ? 1 : 0); +# } + +.method public static signBoolean(Z)I + .registers 2 + .param p0, "x" # Z + + .prologue + .line 58 + if-eqz p0, :cond_8 + + const/4 v0, 0x1 + + :goto_3 + invoke-static {v0}, Ljava/lang/Integer;->signum(I)I + + move-result v0 + + return v0 + + :cond_8 + const/4 v0, 0x0 + + goto :goto_3 +.end method diff --git a/test/566-checker-signum/src-art/Main.java b/test/566-checker-signum/src-art/Main.java new file mode 100644 index 0000000000..f1e1e1bf6e --- /dev/null +++ b/test/566-checker-signum/src-art/Main.java @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2016 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. + */ + +import java.lang.reflect.Method; + +public class Main { + + /// CHECK-START: int Main.signByte(byte) intrinsics_recognition (after) + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signByte(byte) instruction_simplifier (after) + /// CHECK-DAG: <<Result:i\d+>> Compare + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signByte(byte) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int signByte(byte x) { + return Integer.signum(x); + } + + /// CHECK-START: int Main.signShort(short) intrinsics_recognition (after) + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signShort(short) instruction_simplifier (after) + /// CHECK-DAG: <<Result:i\d+>> Compare + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signShort(short) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int signShort(short x) { + return Integer.signum(x); + } + + /// CHECK-START: int Main.signChar(char) intrinsics_recognition (after) + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signChar(char) instruction_simplifier (after) + /// CHECK-DAG: <<Result:i\d+>> Compare + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signChar(char) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int signChar(char x) { + return Integer.signum(x); + } + + /// CHECK-START: int Main.signInt(int) intrinsics_recognition (after) + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signInt(int) instruction_simplifier (after) + /// CHECK-DAG: <<Result:i\d+>> Compare + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signInt(int) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int signInt(int x) { + return Integer.signum(x); + } + + /// CHECK-START: int Main.signLong(long) intrinsics_recognition (after) + /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:LongSignum + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signLong(long) instruction_simplifier (after) + /// CHECK-DAG: <<Result:i\d+>> Compare + /// CHECK-DAG: Return [<<Result>>] + + /// CHECK-START: int Main.signLong(long) instruction_simplifier (after) + /// CHECK-NOT: InvokeStaticOrDirect + + private static int signLong(long x) { + return Long.signum(x); + } + + + public static void testSignBoolean() throws Exception { + Method signBoolean = Class.forName("Main2").getMethod("signBoolean", boolean.class); + expectEquals(0, (int)signBoolean.invoke(null, false)); + expectEquals(1, (int)signBoolean.invoke(null, true)); + } + + public static void testSignByte() { + expectEquals(-1, signByte((byte)Byte.MIN_VALUE)); + expectEquals(-1, signByte((byte)-64)); + expectEquals(-1, signByte((byte)-1)); + expectEquals(0, signByte((byte)0)); + expectEquals(1, signByte((byte)1)); + expectEquals(1, signByte((byte)64)); + expectEquals(1, signByte((byte)Byte.MAX_VALUE)); + } + + public static void testSignShort() { + expectEquals(-1, signShort((short)Short.MIN_VALUE)); + expectEquals(-1, signShort((short)-12345)); + expectEquals(-1, signShort((short)-1)); + expectEquals(0, signShort((short)0)); + expectEquals(1, signShort((short)1)); + expectEquals(1, signShort((short)12345)); + expectEquals(1, signShort((short)Short.MAX_VALUE)); + } + + public static void testSignChar() { + expectEquals(0, signChar((char)0)); + expectEquals(1, signChar((char)1)); + expectEquals(1, signChar((char)12345)); + expectEquals(1, signChar((char)Character.MAX_VALUE)); + } + + public static void testSignInt() { + expectEquals(-1, signInt(Integer.MIN_VALUE)); + expectEquals(-1, signInt(-12345)); + expectEquals(-1, signInt(-1)); + expectEquals(0, signInt(0)); + expectEquals(1, signInt(1)); + expectEquals(1, signInt(12345)); + expectEquals(1, signInt(Integer.MAX_VALUE)); + + for (int i = -11; i <= 11; i++) { + int expected = 0; + if (i < 0) expected = -1; + else if (i > 0) expected = 1; + expectEquals(expected, signInt(i)); + } + } + + public static void testSignLong() { + expectEquals(-1, signLong(Long.MIN_VALUE)); + expectEquals(-1, signLong(-12345L)); + expectEquals(-1, signLong(-1L)); + expectEquals(0, signLong(0L)); + expectEquals(1, signLong(1L)); + expectEquals(1, signLong(12345L)); + expectEquals(1, signLong(Long.MAX_VALUE)); + + expectEquals(-1, signLong(0x800000007FFFFFFFL)); + expectEquals(-1, signLong(0x80000000FFFFFFFFL)); + expectEquals(1, signLong(0x000000007FFFFFFFL)); + expectEquals(1, signLong(0x00000000FFFFFFFFL)); + expectEquals(1, signLong(0x7FFFFFFF7FFFFFFFL)); + expectEquals(1, signLong(0x7FFFFFFFFFFFFFFFL)); + + for (long i = -11L; i <= 11L; i++) { + int expected = 0; + if (i < 0) expected = -1; + else if (i > 0) expected = 1; + expectEquals(expected, signLong(i)); + } + + for (long i = Long.MIN_VALUE; i <= Long.MIN_VALUE + 11L; i++) { + expectEquals(-1, signLong(i)); + } + + for (long i = Long.MAX_VALUE; i >= Long.MAX_VALUE - 11L; i--) { + expectEquals(1, signLong(i)); + } + } + + + public static void main(String args[]) throws Exception { + testSignBoolean(); + testSignByte(); + testSignShort(); + testSignChar(); + testSignInt(); + testSignLong(); + + System.out.println("passed"); + } + + private static void expectEquals(int expected, int result) { + if (expected != result) { + throw new Error("Expected: " + expected + ", found: " + result); + } + } +} diff --git a/test/566-checker-signum/src/Main.java b/test/566-checker-signum/src/Main.java index 7fc9e84055..fa8e5cd1fe 100644 --- a/test/566-checker-signum/src/Main.java +++ b/test/566-checker-signum/src/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,222 +14,9 @@ * limitations under the License. */ +// This file is just for running on the RI as the test is ART specific. public class Main { - - /// CHECK-START: int Main.signBoolean(boolean) intrinsics_recognition (after) - /// CHECK-DAG: <<Method:[ij]\d+>> CurrentMethod - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Phi:i\d+>> Phi [<<One>>,<<Zero>>] - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect [<<Phi>>,<<Method>>] intrinsic:IntegerSignum - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signBoolean(boolean) instruction_simplifier (after) - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Phi:i\d+>> Phi [<<One>>,<<Zero>>] - /// CHECK-DAG: <<Result:i\d+>> Compare [<<Phi>>,<<Zero>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signBoolean(boolean) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - /// CHECK-START: int Main.signBoolean(boolean) select_generator (after) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<One:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Sel:i\d+>> Select [<<Zero>>,<<One>>,<<Arg>>] - /// CHECK-DAG: <<Result:i\d+>> Compare [<<Sel>>,<<Zero>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signBoolean(boolean) select_generator (after) - /// CHECK-NOT: Phi - - /// CHECK-START: int Main.signBoolean(boolean) instruction_simplifier$after_bce (after) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: <<Zero:i\d+>> IntConstant 0 - /// CHECK-DAG: <<Result:i\d+>> Compare [<<Arg>>,<<Zero>>] - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signBoolean(boolean) instruction_simplifier$after_bce (after) - /// CHECK-NOT: Select - - private static int signBoolean(boolean x) { - return Integer.signum(x ? 1 : 0); - } - - /// CHECK-START: int Main.signByte(byte) intrinsics_recognition (after) - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signByte(byte) instruction_simplifier (after) - /// CHECK-DAG: <<Result:i\d+>> Compare - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signByte(byte) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int signByte(byte x) { - return Integer.signum(x); - } - - /// CHECK-START: int Main.signShort(short) intrinsics_recognition (after) - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signShort(short) instruction_simplifier (after) - /// CHECK-DAG: <<Result:i\d+>> Compare - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signShort(short) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int signShort(short x) { - return Integer.signum(x); - } - - /// CHECK-START: int Main.signChar(char) intrinsics_recognition (after) - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signChar(char) instruction_simplifier (after) - /// CHECK-DAG: <<Result:i\d+>> Compare - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signChar(char) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int signChar(char x) { - return Integer.signum(x); - } - - /// CHECK-START: int Main.signInt(int) intrinsics_recognition (after) - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:IntegerSignum - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signInt(int) instruction_simplifier (after) - /// CHECK-DAG: <<Result:i\d+>> Compare - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signInt(int) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int signInt(int x) { - return Integer.signum(x); - } - - /// CHECK-START: int Main.signLong(long) intrinsics_recognition (after) - /// CHECK-DAG: <<Result:i\d+>> InvokeStaticOrDirect intrinsic:LongSignum - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signLong(long) instruction_simplifier (after) - /// CHECK-DAG: <<Result:i\d+>> Compare - /// CHECK-DAG: Return [<<Result>>] - - /// CHECK-START: int Main.signLong(long) instruction_simplifier (after) - /// CHECK-NOT: InvokeStaticOrDirect - - private static int signLong(long x) { - return Long.signum(x); - } - - - public static void testSignBoolean() { - expectEquals(0, signBoolean(false)); - expectEquals(1, signBoolean(true)); - } - - public static void testSignByte() { - expectEquals(-1, signByte((byte)Byte.MIN_VALUE)); - expectEquals(-1, signByte((byte)-64)); - expectEquals(-1, signByte((byte)-1)); - expectEquals(0, signByte((byte)0)); - expectEquals(1, signByte((byte)1)); - expectEquals(1, signByte((byte)64)); - expectEquals(1, signByte((byte)Byte.MAX_VALUE)); - } - - public static void testSignShort() { - expectEquals(-1, signShort((short)Short.MIN_VALUE)); - expectEquals(-1, signShort((short)-12345)); - expectEquals(-1, signShort((short)-1)); - expectEquals(0, signShort((short)0)); - expectEquals(1, signShort((short)1)); - expectEquals(1, signShort((short)12345)); - expectEquals(1, signShort((short)Short.MAX_VALUE)); - } - - public static void testSignChar() { - expectEquals(0, signChar((char)0)); - expectEquals(1, signChar((char)1)); - expectEquals(1, signChar((char)12345)); - expectEquals(1, signChar((char)Character.MAX_VALUE)); - } - - public static void testSignInt() { - expectEquals(-1, signInt(Integer.MIN_VALUE)); - expectEquals(-1, signInt(-12345)); - expectEquals(-1, signInt(-1)); - expectEquals(0, signInt(0)); - expectEquals(1, signInt(1)); - expectEquals(1, signInt(12345)); - expectEquals(1, signInt(Integer.MAX_VALUE)); - - for (int i = -11; i <= 11; i++) { - int expected = 0; - if (i < 0) expected = -1; - else if (i > 0) expected = 1; - expectEquals(expected, signInt(i)); - } - } - - public static void testSignLong() { - expectEquals(-1, signLong(Long.MIN_VALUE)); - expectEquals(-1, signLong(-12345L)); - expectEquals(-1, signLong(-1L)); - expectEquals(0, signLong(0L)); - expectEquals(1, signLong(1L)); - expectEquals(1, signLong(12345L)); - expectEquals(1, signLong(Long.MAX_VALUE)); - - expectEquals(-1, signLong(0x800000007FFFFFFFL)); - expectEquals(-1, signLong(0x80000000FFFFFFFFL)); - expectEquals(1, signLong(0x000000007FFFFFFFL)); - expectEquals(1, signLong(0x00000000FFFFFFFFL)); - expectEquals(1, signLong(0x7FFFFFFF7FFFFFFFL)); - expectEquals(1, signLong(0x7FFFFFFFFFFFFFFFL)); - - for (long i = -11L; i <= 11L; i++) { - int expected = 0; - if (i < 0) expected = -1; - else if (i > 0) expected = 1; - expectEquals(expected, signLong(i)); - } - - for (long i = Long.MIN_VALUE; i <= Long.MIN_VALUE + 11L; i++) { - expectEquals(-1, signLong(i)); - } - - for (long i = Long.MAX_VALUE; i >= Long.MAX_VALUE - 11L; i--) { - expectEquals(1, signLong(i)); - } - } - - - public static void main(String args[]) { - testSignBoolean(); - testSignByte(); - testSignShort(); - testSignChar(); - testSignInt(); - testSignLong(); - + public static void main(String[] args) { System.out.println("passed"); } - - private static void expectEquals(int expected, int result) { - if (expected != result) { - throw new Error("Expected: " + expected + ", found: " + result); - } - } } diff --git a/test/569-checker-pattern-replacement/build b/test/569-checker-pattern-replacement/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/569-checker-pattern-replacement/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/570-checker-osr/build b/test/570-checker-osr/build deleted file mode 100644 index 10ffcc537d..0000000000 --- a/test/570-checker-osr/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/583-checker-zero/build b/test/583-checker-zero/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/583-checker-zero/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/618-checker-induction/build b/test/618-checker-induction/build deleted file mode 100644 index 10ffcc537d..0000000000 --- a/test/618-checker-induction/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/618-checker-induction/src/Main.java b/test/618-checker-induction/src/Main.java index 0080ffa464..1460725e10 100644 --- a/test/618-checker-induction/src/Main.java +++ b/test/618-checker-induction/src/Main.java @@ -290,7 +290,7 @@ public class Main { /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop1>> outer_loop:none /// CHECK-DAG: <<Phi3:i\d+>> Phi loop:<<Loop2:B\d+>> outer_loop:<<Loop1>> /// CHECK-DAG: <<Phi4:i\d+>> Phi loop:<<Loop2>> outer_loop:<<Loop1>> - /// CHECK-DAG: Return [<<Phi1>>] loop:none + /// CHECK-DAG: Return [<<Phi2>>] loop:none // /// CHECK-START: int Main.closedFormNested() loop_optimization (after) /// CHECK-NOT: Phi @@ -313,7 +313,7 @@ public class Main { /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop1>> outer_loop:none /// CHECK-DAG: <<Phi3:i\d+>> Phi loop:<<Loop2:B\d+>> outer_loop:<<Loop1>> /// CHECK-DAG: <<Phi4:i\d+>> Phi loop:<<Loop2>> outer_loop:<<Loop1>> - /// CHECK-DAG: Return [<<Phi1>>] loop:none + /// CHECK-DAG: Return [<<Phi2>>] loop:none // /// CHECK-START: int Main.closedFormNestedAlt() loop_optimization (after) /// CHECK-NOT: Phi @@ -411,7 +411,7 @@ public class Main { /// CHECK-START: int Main.periodicReturned9() loop_optimization (before) /// CHECK-DAG: <<Phi1:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop>> outer_loop:none - /// CHECK-DAG: Return [<<Phi2>>] loop:none + /// CHECK-DAG: Return [<<Phi1>>] loop:none // /// CHECK-START: int Main.periodicReturned9() loop_optimization (after) /// CHECK-NOT: Phi @@ -430,7 +430,7 @@ public class Main { /// CHECK-START: int Main.periodicReturned10() loop_optimization (before) /// CHECK-DAG: <<Phi1:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop>> outer_loop:none - /// CHECK-DAG: Return [<<Phi2>>] loop:none + /// CHECK-DAG: Return [<<Phi1>>] loop:none // /// CHECK-START: int Main.periodicReturned10() loop_optimization (after) /// CHECK-NOT: Phi @@ -450,7 +450,7 @@ public class Main { /// CHECK-DAG: <<Phi1:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Phi3:i\d+>> Phi loop:<<Loop>> outer_loop:none - /// CHECK-DAG: Return [<<Phi3>>] loop:none + /// CHECK-DAG: Return [<<Phi2>>] loop:none // /// CHECK-START: int Main.getSum21() loop_optimization (after) /// CHECK-NOT: Phi @@ -505,7 +505,7 @@ public class Main { /// CHECK-START: int Main.periodicReturnedN(int) loop_optimization (before) /// CHECK-DAG: <<Phi1:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop>> outer_loop:none - /// CHECK-DAG: Return [<<Phi2>>] loop:none + /// CHECK-DAG: Return [<<Phi1>>] loop:none // /// CHECK-START: int Main.periodicReturnedN(int) loop_optimization (after) /// CHECK-NOT: Phi @@ -547,7 +547,7 @@ public class Main { /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop1>> outer_loop:none /// CHECK-DAG: <<Phi3:i\d+>> Phi loop:<<Loop2:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi4:i\d+>> Phi loop:<<Loop2>> outer_loop:none - /// CHECK-DAG: Return [<<Phi3>>] loop:none + /// CHECK-DAG: Return [<<Phi4>>] loop:none /// CHECK-EVAL: "<<Loop1>>" != "<<Loop2>>" // /// CHECK-START: int Main.closedFeed() loop_optimization (after) @@ -691,7 +691,7 @@ public class Main { /// CHECK-START: boolean Main.periodicBoolIdiom1N(boolean, int) loop_optimization (before) /// CHECK-DAG: <<Phi1:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop>> outer_loop:none - /// CHECK-DAG: Return [<<Phi2>>] loop:none + /// CHECK-DAG: Return [<<Phi1>>] loop:none // /// CHECK-START: boolean Main.periodicBoolIdiom1N(boolean, int) loop_optimization (after) /// CHECK-NOT: Phi @@ -705,7 +705,7 @@ public class Main { /// CHECK-START: boolean Main.periodicBoolIdiom2N(boolean, int) loop_optimization (before) /// CHECK-DAG: <<Phi1:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop>> outer_loop:none - /// CHECK-DAG: Return [<<Phi2>>] loop:none + /// CHECK-DAG: Return [<<Phi1>>] loop:none // /// CHECK-START: boolean Main.periodicBoolIdiom2N(boolean, int) loop_optimization (after) /// CHECK-NOT: Phi @@ -719,7 +719,7 @@ public class Main { /// CHECK-START: boolean Main.periodicBoolIdiom3N(boolean, int) loop_optimization (before) /// CHECK-DAG: <<Phi1:i\d+>> Phi loop:<<Loop:B\d+>> outer_loop:none /// CHECK-DAG: <<Phi2:i\d+>> Phi loop:<<Loop>> outer_loop:none - /// CHECK-DAG: Return [<<Phi2>>] loop:none + /// CHECK-DAG: Return [<<Phi1>>] loop:none // /// CHECK-START: boolean Main.periodicBoolIdiom3N(boolean, int) loop_optimization (after) /// CHECK-NOT: Phi diff --git a/test/626-checker-arm64-scratch-register/build b/test/626-checker-arm64-scratch-register/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/626-checker-arm64-scratch-register/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/626-checker-arm64-scratch-register/smali/Main2.smali b/test/626-checker-arm64-scratch-register/smali/Main2.smali new file mode 100644 index 0000000000..914ae6eeaf --- /dev/null +++ b/test/626-checker-arm64-scratch-register/smali/Main2.smali @@ -0,0 +1,1768 @@ +# Copyright (C) 2018 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. + +.class public LMain2; +.super Ljava/lang/Object; + + +# instance fields +.field b00:Z + +.field b01:Z + +.field b02:Z + +.field b03:Z + +.field b04:Z + +.field b05:Z + +.field b06:Z + +.field b07:Z + +.field b08:Z + +.field b09:Z + +.field b10:Z + +.field b11:Z + +.field b12:Z + +.field b13:Z + +.field b14:Z + +.field b15:Z + +.field b16:Z + +.field b17:Z + +.field b18:Z + +.field b19:Z + +.field b20:Z + +.field b21:Z + +.field b22:Z + +.field b23:Z + +.field b24:Z + +.field b25:Z + +.field b26:Z + +.field b27:Z + +.field b28:Z + +.field b29:Z + +.field b30:Z + +.field b31:Z + +.field b32:Z + +.field b33:Z + +.field b34:Z + +.field b35:Z + +.field b36:Z + +.field conditionA:Z + +.field conditionB:Z + +.field conditionC:Z + + +# direct methods +.method public constructor <init>()V + .registers 1 + + .prologue + .line 17 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + + return-void +.end method + +## CHECK-START-ARM64: void Main2.test() register (after) +## CHECK: begin_block +## CHECK: name "B0" +## CHECK: <<This:l\d+>> ParameterValue +## CHECK: end_block +## CHECK: begin_block +## CHECK: successors "<<ThenBlock:B\d+>>" "<<ElseBlock:B\d+>>" +## CHECK: <<CondB:z\d+>> InstanceFieldGet [<<This>>] field_name:Main2.conditionB +## CHECK: If [<<CondB>>] +## CHECK: end_block +## CHECK: begin_block +## CHECK: name "<<ElseBlock>>" +## CHECK: ParallelMove moves:[40(sp)->d0,24(sp)->32(sp),28(sp)->36(sp),d0->d3,d3->d4,d2->d5,d4->d6,d5->d7,d6->d18,d7->d19,d18->d20,d19->d21,d20->d22,d21->d23,d22->d10,d23->d11,16(sp)->24(sp),20(sp)->28(sp),d10->d14,d11->d12,d12->d13,d13->d1,d14->d2,32(sp)->16(sp),36(sp)->20(sp)] +## CHECK: end_block + +## CHECK-START-ARM64: void Main2.test() disassembly (after) +## CHECK: begin_block +## CHECK: name "B0" +## CHECK: <<This:l\d+>> ParameterValue +## CHECK: end_block +## CHECK: begin_block +## CHECK: successors "<<ThenBlock:B\d+>>" "<<ElseBlock:B\d+>>" +## CHECK: <<CondB:z\d+>> InstanceFieldGet [<<This>>] field_name:Main2.conditionB +## CHECK: If [<<CondB>>] +## CHECK: end_block +## CHECK: begin_block +## CHECK: name "<<ElseBlock>>" +## CHECK: ParallelMove moves:[invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid] +## CHECK: fmov d31, d2 +## CHECK: ldr s2, [sp, #36] +## CHECK: ldr w16, [sp, #16] +## CHECK: str w16, [sp, #36] +## CHECK: str s14, [sp, #16] +## CHECK: ldr s14, [sp, #28] +## CHECK: str s1, [sp, #28] +## CHECK: ldr s1, [sp, #32] +## CHECK: str s31, [sp, #32] +## CHECK: ldr s31, [sp, #20] +## CHECK: str s31, [sp, #40] +## CHECK: str s12, [sp, #20] +## CHECK: fmov d12, d11 +## CHECK: fmov d11, d10 +## CHECK: fmov d10, d23 +## CHECK: fmov d23, d22 +## CHECK: fmov d22, d21 +## CHECK: fmov d21, d20 +## CHECK: fmov d20, d19 +## CHECK: fmov d19, d18 +## CHECK: fmov d18, d7 +## CHECK: fmov d7, d6 +## CHECK: fmov d6, d5 +## CHECK: fmov d5, d4 +## CHECK: fmov d4, d3 +## CHECK: fmov d3, d13 +## CHECK: ldr s13, [sp, #24] +## CHECK: str s3, [sp, #24] +## CHECK: ldr s3, pc+{{\d+}} (addr {{0x[0-9a-f]+}}) (100) +## CHECK: end_block + +# Original java source: +# +# public void test() { +# String r = ""; +# +# // For the purpose of this regression test, the order of +# // definition of these float variable matters. Likewise with the +# // order of the instructions where these variables are used below. +# // Reordering these lines make make the original (b/32545705) +# // issue vanish. +# float f17 = b17 ? 0.0f : 1.0f; +# float f16 = b16 ? 0.0f : 1.0f; +# float f18 = b18 ? 0.0f : 1.0f; +# float f19 = b19 ? 0.0f : 1.0f; +# float f20 = b20 ? 0.0f : 1.0f; +# float f21 = b21 ? 0.0f : 1.0f; +# float f15 = b15 ? 0.0f : 1.0f; +# float f00 = b00 ? 0.0f : 1.0f; +# float f22 = b22 ? 0.0f : 1.0f; +# float f23 = b23 ? 0.0f : 1.0f; +# float f24 = b24 ? 0.0f : 1.0f; +# float f25 = b25 ? 0.0f : 1.0f; +# float f26 = b26 ? 0.0f : 1.0f; +# float f27 = b27 ? 0.0f : 1.0f; +# float f29 = b29 ? 0.0f : 1.0f; +# float f28 = b28 ? 0.0f : 1.0f; +# float f01 = b01 ? 0.0f : 1.0f; +# float f02 = b02 ? 0.0f : 1.0f; +# float f03 = b03 ? 0.0f : 1.0f; +# float f04 = b04 ? 0.0f : 1.0f; +# float f05 = b05 ? 0.0f : 1.0f; +# float f07 = b07 ? 0.0f : 1.0f; +# float f06 = b06 ? 0.0f : 1.0f; +# float f30 = b30 ? 0.0f : 1.0f; +# float f31 = b31 ? 0.0f : 1.0f; +# float f32 = b32 ? 0.0f : 1.0f; +# float f33 = b33 ? 0.0f : 1.0f; +# float f34 = b34 ? 0.0f : 1.0f; +# float f36 = b36 ? 0.0f : 1.0f; +# float f35 = b35 ? 0.0f : 1.0f; +# float f08 = b08 ? 0.0f : 1.0f; +# float f09 = b09 ? 0.0f : 1.0f; +# float f10 = b10 ? 0.0f : 1.0f; +# float f11 = b11 ? 0.0f : 1.0f; +# float f12 = b12 ? 0.0f : 1.0f; +# float f14 = b14 ? 0.0f : 1.0f; +# float f13 = b13 ? 0.0f : 1.0f; +# +# if (conditionA) { +# f16 /= 1000.0f; +# f17 /= 1000.0f; +# f18 /= 1000.0f; +# f19 /= 1000.0f; +# f20 /= 1000.0f; +# f21 /= 1000.0f; +# f15 /= 1000.0f; +# f08 /= 1000.0f; +# f09 /= 1000.0f; +# f10 /= 1000.0f; +# f11 /= 1000.0f; +# f12 /= 1000.0f; +# f30 /= 1000.0f; +# f31 /= 1000.0f; +# f32 /= 1000.0f; +# f33 /= 1000.0f; +# f34 /= 1000.0f; +# f01 /= 1000.0f; +# f02 /= 1000.0f; +# f03 /= 1000.0f; +# f04 /= 1000.0f; +# f05 /= 1000.0f; +# f23 /= 1000.0f; +# f24 /= 1000.0f; +# f25 /= 1000.0f; +# f26 /= 1000.0f; +# f27 /= 1000.0f; +# f22 /= 1000.0f; +# f00 /= 1000.0f; +# f14 /= 1000.0f; +# f13 /= 1000.0f; +# f36 /= 1000.0f; +# f35 /= 1000.0f; +# f07 /= 1000.0f; +# f06 /= 1000.0f; +# f29 /= 1000.0f; +# f28 /= 1000.0f; +# } +# // The parallel move that used to exhaust the ARM64 parallel move +# // resolver's scratch register pool (provided by VIXL) was in the +# // "else" branch of the following condition generated by ART's +# // compiler. +# if (conditionB) { +# f16 /= 100.0f; +# f17 /= 100.0f; +# f18 /= 100.0f; +# f19 /= 100.0f; +# f20 /= 100.0f; +# f21 /= 100.0f; +# f15 /= 100.0f; +# f08 /= 100.0f; +# f09 /= 100.0f; +# f10 /= 100.0f; +# f11 /= 100.0f; +# f12 /= 100.0f; +# f30 /= 100.0f; +# f31 /= 100.0f; +# f32 /= 100.0f; +# f33 /= 100.0f; +# f34 /= 100.0f; +# f01 /= 100.0f; +# f02 /= 100.0f; +# f03 /= 100.0f; +# f04 /= 100.0f; +# f05 /= 100.0f; +# f23 /= 100.0f; +# f24 /= 100.0f; +# f25 /= 100.0f; +# f26 /= 100.0f; +# f27 /= 100.0f; +# f22 /= 100.0f; +# f00 /= 100.0f; +# f14 /= 100.0f; +# f13 /= 100.0f; +# f36 /= 100.0f; +# f35 /= 100.0f; +# f07 /= 100.0f; +# f06 /= 100.0f; +# f29 /= 100.0f; +# f28 /= 100.0f; +# } +# if (conditionC) { +# f16 /= 12.0f; +# f17 /= 12.0f; +# f18 /= 12.0f; +# f19 /= 12.0f; +# f20 /= 12.0f; +# f21 /= 12.0f; +# f15 /= 12.0f; +# f08 /= 12.0f; +# f09 /= 12.0f; +# f10 /= 12.0f; +# f11 /= 12.0f; +# f12 /= 12.0f; +# f30 /= 12.0f; +# f31 /= 12.0f; +# f32 /= 12.0f; +# f33 /= 12.0f; +# f34 /= 12.0f; +# f01 /= 12.0f; +# f02 /= 12.0f; +# f03 /= 12.0f; +# f04 /= 12.0f; +# f05 /= 12.0f; +# f23 /= 12.0f; +# f24 /= 12.0f; +# f25 /= 12.0f; +# f26 /= 12.0f; +# f27 /= 12.0f; +# f22 /= 12.0f; +# f00 /= 12.0f; +# f14 /= 12.0f; +# f13 /= 12.0f; +# f36 /= 12.0f; +# f35 /= 12.0f; +# f07 /= 12.0f; +# f06 /= 12.0f; +# f29 /= 12.0f; +# f28 /= 12.0f; +# } +# float s = 0.0f; +# s = ((float) Math.round(100.0f * s)) / 100.0f; +# String res = s + r; +# } + +# virtual methods +.method public test()V + .registers 45 + + .prologue + .line 121 + const-string v39, "" + + .line 128 + .local v39, "r":Ljava/lang/String; + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b17:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_367 + + const/16 v19, 0x0 + + .line 129 + .local v19, "f17":F + :goto_c + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b16:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_36b + + const/16 v18, 0x0 + + .line 130 + .local v18, "f16":F + :goto_16 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b18:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_36f + + const/16 v20, 0x0 + + .line 131 + .local v20, "f18":F + :goto_20 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b19:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_373 + + const/16 v21, 0x0 + + .line 132 + .local v21, "f19":F + :goto_2a + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b20:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_377 + + const/16 v22, 0x0 + + .line 133 + .local v22, "f20":F + :goto_34 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b21:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_37b + + const/16 v23, 0x0 + + .line 134 + .local v23, "f21":F + :goto_3e + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b15:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_37f + + const/16 v17, 0x0 + + .line 135 + .local v17, "f15":F + :goto_48 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b00:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_383 + + const/4 v2, 0x0 + + .line 136 + .local v2, "f00":F + :goto_51 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b22:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_387 + + const/16 v24, 0x0 + + .line 137 + .local v24, "f22":F + :goto_5b + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b23:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_38b + + const/16 v25, 0x0 + + .line 138 + .local v25, "f23":F + :goto_65 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b24:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_38f + + const/16 v26, 0x0 + + .line 139 + .local v26, "f24":F + :goto_6f + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b25:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_393 + + const/16 v27, 0x0 + + .line 140 + .local v27, "f25":F + :goto_79 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b26:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_397 + + const/16 v28, 0x0 + + .line 141 + .local v28, "f26":F + :goto_83 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b27:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_39b + + const/16 v29, 0x0 + + .line 142 + .local v29, "f27":F + :goto_8d + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b29:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_39f + + const/16 v31, 0x0 + + .line 143 + .local v31, "f29":F + :goto_97 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b28:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3a3 + + const/16 v30, 0x0 + + .line 144 + .local v30, "f28":F + :goto_a1 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b01:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3a7 + + const/4 v3, 0x0 + + .line 145 + .local v3, "f01":F + :goto_aa + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b02:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3ab + + const/4 v4, 0x0 + + .line 146 + .local v4, "f02":F + :goto_b3 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b03:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3af + + const/4 v5, 0x0 + + .line 147 + .local v5, "f03":F + :goto_bc + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b04:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3b3 + + const/4 v6, 0x0 + + .line 148 + .local v6, "f04":F + :goto_c5 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b05:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3b7 + + const/4 v7, 0x0 + + .line 149 + .local v7, "f05":F + :goto_ce + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b07:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3bb + + const/4 v9, 0x0 + + .line 150 + .local v9, "f07":F + :goto_d7 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b06:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3bf + + const/4 v8, 0x0 + + .line 151 + .local v8, "f06":F + :goto_e0 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b30:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3c3 + + const/16 v32, 0x0 + + .line 152 + .local v32, "f30":F + :goto_ea + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b31:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3c7 + + const/16 v33, 0x0 + + .line 153 + .local v33, "f31":F + :goto_f4 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b32:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3cb + + const/16 v34, 0x0 + + .line 154 + .local v34, "f32":F + :goto_fe + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b33:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3cf + + const/16 v35, 0x0 + + .line 155 + .local v35, "f33":F + :goto_108 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b34:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3d3 + + const/16 v36, 0x0 + + .line 156 + .local v36, "f34":F + :goto_112 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b36:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3d7 + + const/16 v38, 0x0 + + .line 157 + .local v38, "f36":F + :goto_11c + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b35:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3db + + const/16 v37, 0x0 + + .line 158 + .local v37, "f35":F + :goto_126 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b08:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3df + + const/4 v10, 0x0 + + .line 159 + .local v10, "f08":F + :goto_12f + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b09:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3e3 + + const/4 v11, 0x0 + + .line 160 + .local v11, "f09":F + :goto_138 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b10:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3e7 + + const/4 v12, 0x0 + + .line 161 + .local v12, "f10":F + :goto_141 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b11:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3eb + + const/4 v13, 0x0 + + .line 162 + .local v13, "f11":F + :goto_14a + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b12:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3ef + + const/4 v14, 0x0 + + .line 163 + .local v14, "f12":F + :goto_153 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b14:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3f3 + + const/16 v16, 0x0 + + .line 164 + .local v16, "f14":F + :goto_15d + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->b13:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_3f7 + + const/4 v15, 0x0 + + .line 166 + .local v15, "f13":F + :goto_166 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->conditionA:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_202 + + .line 167 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v18, v18, v42 + + .line 168 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v19, v19, v42 + + .line 169 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v20, v20, v42 + + .line 170 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v21, v21, v42 + + .line 171 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v22, v22, v42 + + .line 172 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v23, v23, v42 + + .line 173 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v17, v17, v42 + + .line 174 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v10, v10, v42 + + .line 175 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v11, v11, v42 + + .line 176 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v12, v12, v42 + + .line 177 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v13, v13, v42 + + .line 178 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v14, v14, v42 + + .line 179 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v32, v32, v42 + + .line 180 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v33, v33, v42 + + .line 181 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v34, v34, v42 + + .line 182 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v35, v35, v42 + + .line 183 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v36, v36, v42 + + .line 184 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v3, v3, v42 + + .line 185 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v4, v4, v42 + + .line 186 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v5, v5, v42 + + .line 187 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v6, v6, v42 + + .line 188 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v7, v7, v42 + + .line 189 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v25, v25, v42 + + .line 190 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v26, v26, v42 + + .line 191 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v27, v27, v42 + + .line 192 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v28, v28, v42 + + .line 193 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v29, v29, v42 + + .line 194 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v24, v24, v42 + + .line 195 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v2, v2, v42 + + .line 196 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v16, v16, v42 + + .line 197 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v15, v15, v42 + + .line 198 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v38, v38, v42 + + .line 199 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v37, v37, v42 + + .line 200 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v9, v9, v42 + + .line 201 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v8, v8, v42 + + .line 202 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v31, v31, v42 + + .line 203 + const/high16 v42, 0x447a0000 # 1000.0f + + div-float v30, v30, v42 + + .line 209 + :cond_202 + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->conditionB:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_29e + + .line 210 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v18, v18, v42 + + .line 211 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v19, v19, v42 + + .line 212 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v20, v20, v42 + + .line 213 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v21, v21, v42 + + .line 214 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v22, v22, v42 + + .line 215 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v23, v23, v42 + + .line 216 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v17, v17, v42 + + .line 217 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v10, v10, v42 + + .line 218 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v11, v11, v42 + + .line 219 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v12, v12, v42 + + .line 220 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v13, v13, v42 + + .line 221 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v14, v14, v42 + + .line 222 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v32, v32, v42 + + .line 223 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v33, v33, v42 + + .line 224 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v34, v34, v42 + + .line 225 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v35, v35, v42 + + .line 226 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v36, v36, v42 + + .line 227 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v3, v3, v42 + + .line 228 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v4, v4, v42 + + .line 229 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v5, v5, v42 + + .line 230 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v6, v6, v42 + + .line 231 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v7, v7, v42 + + .line 232 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v25, v25, v42 + + .line 233 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v26, v26, v42 + + .line 234 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v27, v27, v42 + + .line 235 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v28, v28, v42 + + .line 236 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v29, v29, v42 + + .line 237 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v24, v24, v42 + + .line 238 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v2, v2, v42 + + .line 239 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v16, v16, v42 + + .line 240 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v15, v15, v42 + + .line 241 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v38, v38, v42 + + .line 242 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v37, v37, v42 + + .line 243 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v9, v9, v42 + + .line 244 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v8, v8, v42 + + .line 245 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v31, v31, v42 + + .line 246 + const/high16 v42, 0x42c80000 # 100.0f + + div-float v30, v30, v42 + + .line 248 + :cond_29e + move-object/from16 v0, p0 + + iget-boolean v0, v0, LMain2;->conditionC:Z + + move/from16 v42, v0 + + if-eqz v42, :cond_33a + + .line 249 + const/high16 v42, 0x41400000 # 12.0f + + div-float v18, v18, v42 + + .line 250 + const/high16 v42, 0x41400000 # 12.0f + + div-float v19, v19, v42 + + .line 251 + const/high16 v42, 0x41400000 # 12.0f + + div-float v20, v20, v42 + + .line 252 + const/high16 v42, 0x41400000 # 12.0f + + div-float v21, v21, v42 + + .line 253 + const/high16 v42, 0x41400000 # 12.0f + + div-float v22, v22, v42 + + .line 254 + const/high16 v42, 0x41400000 # 12.0f + + div-float v23, v23, v42 + + .line 255 + const/high16 v42, 0x41400000 # 12.0f + + div-float v17, v17, v42 + + .line 256 + const/high16 v42, 0x41400000 # 12.0f + + div-float v10, v10, v42 + + .line 257 + const/high16 v42, 0x41400000 # 12.0f + + div-float v11, v11, v42 + + .line 258 + const/high16 v42, 0x41400000 # 12.0f + + div-float v12, v12, v42 + + .line 259 + const/high16 v42, 0x41400000 # 12.0f + + div-float v13, v13, v42 + + .line 260 + const/high16 v42, 0x41400000 # 12.0f + + div-float v14, v14, v42 + + .line 261 + const/high16 v42, 0x41400000 # 12.0f + + div-float v32, v32, v42 + + .line 262 + const/high16 v42, 0x41400000 # 12.0f + + div-float v33, v33, v42 + + .line 263 + const/high16 v42, 0x41400000 # 12.0f + + div-float v34, v34, v42 + + .line 264 + const/high16 v42, 0x41400000 # 12.0f + + div-float v35, v35, v42 + + .line 265 + const/high16 v42, 0x41400000 # 12.0f + + div-float v36, v36, v42 + + .line 266 + const/high16 v42, 0x41400000 # 12.0f + + div-float v3, v3, v42 + + .line 267 + const/high16 v42, 0x41400000 # 12.0f + + div-float v4, v4, v42 + + .line 268 + const/high16 v42, 0x41400000 # 12.0f + + div-float v5, v5, v42 + + .line 269 + const/high16 v42, 0x41400000 # 12.0f + + div-float v6, v6, v42 + + .line 270 + const/high16 v42, 0x41400000 # 12.0f + + div-float v7, v7, v42 + + .line 271 + const/high16 v42, 0x41400000 # 12.0f + + div-float v25, v25, v42 + + .line 272 + const/high16 v42, 0x41400000 # 12.0f + + div-float v26, v26, v42 + + .line 273 + const/high16 v42, 0x41400000 # 12.0f + + div-float v27, v27, v42 + + .line 274 + const/high16 v42, 0x41400000 # 12.0f + + div-float v28, v28, v42 + + .line 275 + const/high16 v42, 0x41400000 # 12.0f + + div-float v29, v29, v42 + + .line 276 + const/high16 v42, 0x41400000 # 12.0f + + div-float v24, v24, v42 + + .line 277 + const/high16 v42, 0x41400000 # 12.0f + + div-float v2, v2, v42 + + .line 278 + const/high16 v42, 0x41400000 # 12.0f + + div-float v16, v16, v42 + + .line 279 + const/high16 v42, 0x41400000 # 12.0f + + div-float v15, v15, v42 + + .line 280 + const/high16 v42, 0x41400000 # 12.0f + + div-float v38, v38, v42 + + .line 281 + const/high16 v42, 0x41400000 # 12.0f + + div-float v37, v37, v42 + + .line 282 + const/high16 v42, 0x41400000 # 12.0f + + div-float v9, v9, v42 + + .line 283 + const/high16 v42, 0x41400000 # 12.0f + + div-float v8, v8, v42 + + .line 284 + const/high16 v42, 0x41400000 # 12.0f + + div-float v31, v31, v42 + + .line 285 + const/high16 v42, 0x41400000 # 12.0f + + div-float v30, v30, v42 + + .line 287 + :cond_33a + const/16 v41, 0x0 + + .line 288 + .local v41, "s":F + const/high16 v42, 0x42c80000 # 100.0f + + mul-float v42, v42, v41 + + invoke-static/range {v42 .. v42}, Ljava/lang/Math;->round(F)I + + move-result v42 + + move/from16 v0, v42 + + int-to-float v0, v0 + + move/from16 v42, v0 + + const/high16 v43, 0x42c80000 # 100.0f + + div-float v41, v42, v43 + + .line 289 + new-instance v42, Ljava/lang/StringBuilder; + + invoke-direct/range {v42 .. v42}, Ljava/lang/StringBuilder;-><init>()V + + move-object/from16 v0, v42 + + move/from16 v1, v41 + + invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder; + + move-result-object v42 + + move-object/from16 v0, v42 + + move-object/from16 v1, v39 + + invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; + + move-result-object v42 + + invoke-virtual/range {v42 .. v42}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; + + move-result-object v40 + + .line 290 + .local v40, "res":Ljava/lang/String; + return-void + + .line 128 + .end local v2 # "f00":F + .end local v3 # "f01":F + .end local v4 # "f02":F + .end local v5 # "f03":F + .end local v6 # "f04":F + .end local v7 # "f05":F + .end local v8 # "f06":F + .end local v9 # "f07":F + .end local v10 # "f08":F + .end local v11 # "f09":F + .end local v12 # "f10":F + .end local v13 # "f11":F + .end local v14 # "f12":F + .end local v15 # "f13":F + .end local v16 # "f14":F + .end local v17 # "f15":F + .end local v18 # "f16":F + .end local v19 # "f17":F + .end local v20 # "f18":F + .end local v21 # "f19":F + .end local v22 # "f20":F + .end local v23 # "f21":F + .end local v24 # "f22":F + .end local v25 # "f23":F + .end local v26 # "f24":F + .end local v27 # "f25":F + .end local v28 # "f26":F + .end local v29 # "f27":F + .end local v30 # "f28":F + .end local v31 # "f29":F + .end local v32 # "f30":F + .end local v33 # "f31":F + .end local v34 # "f32":F + .end local v35 # "f33":F + .end local v36 # "f34":F + .end local v37 # "f35":F + .end local v38 # "f36":F + .end local v40 # "res":Ljava/lang/String; + .end local v41 # "s":F + :cond_367 + const/high16 v19, 0x3f800000 # 1.0f + + goto/16 :goto_c + + .line 129 + .restart local v19 # "f17":F + :cond_36b + const/high16 v18, 0x3f800000 # 1.0f + + goto/16 :goto_16 + + .line 130 + .restart local v18 # "f16":F + :cond_36f + const/high16 v20, 0x3f800000 # 1.0f + + goto/16 :goto_20 + + .line 131 + .restart local v20 # "f18":F + :cond_373 + const/high16 v21, 0x3f800000 # 1.0f + + goto/16 :goto_2a + + .line 132 + .restart local v21 # "f19":F + :cond_377 + const/high16 v22, 0x3f800000 # 1.0f + + goto/16 :goto_34 + + .line 133 + .restart local v22 # "f20":F + :cond_37b + const/high16 v23, 0x3f800000 # 1.0f + + goto/16 :goto_3e + + .line 134 + .restart local v23 # "f21":F + :cond_37f + const/high16 v17, 0x3f800000 # 1.0f + + goto/16 :goto_48 + + .line 135 + .restart local v17 # "f15":F + :cond_383 + const/high16 v2, 0x3f800000 # 1.0f + + goto/16 :goto_51 + + .line 136 + .restart local v2 # "f00":F + :cond_387 + const/high16 v24, 0x3f800000 # 1.0f + + goto/16 :goto_5b + + .line 137 + .restart local v24 # "f22":F + :cond_38b + const/high16 v25, 0x3f800000 # 1.0f + + goto/16 :goto_65 + + .line 138 + .restart local v25 # "f23":F + :cond_38f + const/high16 v26, 0x3f800000 # 1.0f + + goto/16 :goto_6f + + .line 139 + .restart local v26 # "f24":F + :cond_393 + const/high16 v27, 0x3f800000 # 1.0f + + goto/16 :goto_79 + + .line 140 + .restart local v27 # "f25":F + :cond_397 + const/high16 v28, 0x3f800000 # 1.0f + + goto/16 :goto_83 + + .line 141 + .restart local v28 # "f26":F + :cond_39b + const/high16 v29, 0x3f800000 # 1.0f + + goto/16 :goto_8d + + .line 142 + .restart local v29 # "f27":F + :cond_39f + const/high16 v31, 0x3f800000 # 1.0f + + goto/16 :goto_97 + + .line 143 + .restart local v31 # "f29":F + :cond_3a3 + const/high16 v30, 0x3f800000 # 1.0f + + goto/16 :goto_a1 + + .line 144 + .restart local v30 # "f28":F + :cond_3a7 + const/high16 v3, 0x3f800000 # 1.0f + + goto/16 :goto_aa + + .line 145 + .restart local v3 # "f01":F + :cond_3ab + const/high16 v4, 0x3f800000 # 1.0f + + goto/16 :goto_b3 + + .line 146 + .restart local v4 # "f02":F + :cond_3af + const/high16 v5, 0x3f800000 # 1.0f + + goto/16 :goto_bc + + .line 147 + .restart local v5 # "f03":F + :cond_3b3 + const/high16 v6, 0x3f800000 # 1.0f + + goto/16 :goto_c5 + + .line 148 + .restart local v6 # "f04":F + :cond_3b7 + const/high16 v7, 0x3f800000 # 1.0f + + goto/16 :goto_ce + + .line 149 + .restart local v7 # "f05":F + :cond_3bb + const/high16 v9, 0x3f800000 # 1.0f + + goto/16 :goto_d7 + + .line 150 + .restart local v9 # "f07":F + :cond_3bf + const/high16 v8, 0x3f800000 # 1.0f + + goto/16 :goto_e0 + + .line 151 + .restart local v8 # "f06":F + :cond_3c3 + const/high16 v32, 0x3f800000 # 1.0f + + goto/16 :goto_ea + + .line 152 + .restart local v32 # "f30":F + :cond_3c7 + const/high16 v33, 0x3f800000 # 1.0f + + goto/16 :goto_f4 + + .line 153 + .restart local v33 # "f31":F + :cond_3cb + const/high16 v34, 0x3f800000 # 1.0f + + goto/16 :goto_fe + + .line 154 + .restart local v34 # "f32":F + :cond_3cf + const/high16 v35, 0x3f800000 # 1.0f + + goto/16 :goto_108 + + .line 155 + .restart local v35 # "f33":F + :cond_3d3 + const/high16 v36, 0x3f800000 # 1.0f + + goto/16 :goto_112 + + .line 156 + .restart local v36 # "f34":F + :cond_3d7 + const/high16 v38, 0x3f800000 # 1.0f + + goto/16 :goto_11c + + .line 157 + .restart local v38 # "f36":F + :cond_3db + const/high16 v37, 0x3f800000 # 1.0f + + goto/16 :goto_126 + + .line 158 + .restart local v37 # "f35":F + :cond_3df + const/high16 v10, 0x3f800000 # 1.0f + + goto/16 :goto_12f + + .line 159 + .restart local v10 # "f08":F + :cond_3e3 + const/high16 v11, 0x3f800000 # 1.0f + + goto/16 :goto_138 + + .line 160 + .restart local v11 # "f09":F + :cond_3e7 + const/high16 v12, 0x3f800000 # 1.0f + + goto/16 :goto_141 + + .line 161 + .restart local v12 # "f10":F + :cond_3eb + const/high16 v13, 0x3f800000 # 1.0f + + goto/16 :goto_14a + + .line 162 + .restart local v13 # "f11":F + :cond_3ef + const/high16 v14, 0x3f800000 # 1.0f + + goto/16 :goto_153 + + .line 163 + .restart local v14 # "f12":F + :cond_3f3 + const/high16 v16, 0x3f800000 # 1.0f + + goto/16 :goto_15d + + .line 164 + .restart local v16 # "f14":F + :cond_3f7 + const/high16 v15, 0x3f800000 # 1.0f + + goto/16 :goto_166 +.end method diff --git a/test/626-checker-arm64-scratch-register/src-art/Main.java b/test/626-checker-arm64-scratch-register/src-art/Main.java new file mode 100644 index 0000000000..b816586c84 --- /dev/null +++ b/test/626-checker-arm64-scratch-register/src-art/Main.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2018 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) throws Exception { + Class main2 = Class.forName("Main2"); + main2.getMethod("test").invoke(main2.newInstance()); + System.out.println("passed"); + } +} diff --git a/test/626-checker-arm64-scratch-register/src/Main.java b/test/626-checker-arm64-scratch-register/src/Main.java index 139491769e..fa8e5cd1fe 100644 --- a/test/626-checker-arm64-scratch-register/src/Main.java +++ b/test/626-checker-arm64-scratch-register/src/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,284 +14,9 @@ * limitations under the License. */ +// This file is just for running on the RI as the test is ART specific. public class Main { - - boolean b00; - boolean b01; - boolean b02; - boolean b03; - boolean b04; - boolean b05; - boolean b06; - boolean b07; - boolean b08; - boolean b09; - boolean b10; - boolean b11; - boolean b12; - boolean b13; - boolean b14; - boolean b15; - boolean b16; - boolean b17; - boolean b18; - boolean b19; - boolean b20; - boolean b21; - boolean b22; - boolean b23; - boolean b24; - boolean b25; - boolean b26; - boolean b27; - boolean b28; - boolean b29; - boolean b30; - boolean b31; - boolean b32; - boolean b33; - boolean b34; - boolean b35; - boolean b36; - - boolean conditionA; - boolean conditionB; - boolean conditionC; - - /// CHECK-START-ARM64: void Main.test() register (after) - /// CHECK: begin_block - /// CHECK: name "B0" - /// CHECK: <<This:l\d+>> ParameterValue - /// CHECK: end_block - /// CHECK: begin_block - /// CHECK: successors "<<ThenBlock:B\d+>>" "<<ElseBlock:B\d+>>" - /// CHECK: <<CondB:z\d+>> InstanceFieldGet [<<This>>] field_name:Main.conditionB - /// CHECK: If [<<CondB>>] - /// CHECK: end_block - /// CHECK: begin_block - /// CHECK: name "<<ElseBlock>>" - /// CHECK: ParallelMove moves:[40(sp)->d0,24(sp)->32(sp),28(sp)->36(sp),d0->d3,d3->d4,d2->d5,d4->d6,d5->d7,d6->d18,d7->d19,d18->d20,d19->d21,d20->d22,d21->d23,d22->d10,d23->d11,16(sp)->24(sp),20(sp)->28(sp),d10->d14,d11->d12,d12->d13,d13->d1,d14->d2,32(sp)->16(sp),36(sp)->20(sp)] - /// CHECK: end_block - - /// CHECK-START-ARM64: void Main.test() disassembly (after) - /// CHECK: begin_block - /// CHECK: name "B0" - /// CHECK: <<This:l\d+>> ParameterValue - /// CHECK: end_block - /// CHECK: begin_block - /// CHECK: successors "<<ThenBlock:B\d+>>" "<<ElseBlock:B\d+>>" - /// CHECK: <<CondB:z\d+>> InstanceFieldGet [<<This>>] field_name:Main.conditionB - /// CHECK: If [<<CondB>>] - /// CHECK: end_block - /// CHECK: begin_block - /// CHECK: name "<<ElseBlock>>" - /// CHECK: ParallelMove moves:[invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid] - /// CHECK: fmov d31, d2 - /// CHECK: ldr s2, [sp, #36] - /// CHECK: ldr w16, [sp, #16] - /// CHECK: str w16, [sp, #36] - /// CHECK: str s14, [sp, #16] - /// CHECK: ldr s14, [sp, #28] - /// CHECK: str s1, [sp, #28] - /// CHECK: ldr s1, [sp, #32] - /// CHECK: str s31, [sp, #32] - /// CHECK: ldr s31, [sp, #20] - /// CHECK: str s31, [sp, #40] - /// CHECK: str s12, [sp, #20] - /// CHECK: fmov d12, d11 - /// CHECK: fmov d11, d10 - /// CHECK: fmov d10, d23 - /// CHECK: fmov d23, d22 - /// CHECK: fmov d22, d21 - /// CHECK: fmov d21, d20 - /// CHECK: fmov d20, d19 - /// CHECK: fmov d19, d18 - /// CHECK: fmov d18, d7 - /// CHECK: fmov d7, d6 - /// CHECK: fmov d6, d5 - /// CHECK: fmov d5, d4 - /// CHECK: fmov d4, d3 - /// CHECK: fmov d3, d13 - /// CHECK: ldr s13, [sp, #24] - /// CHECK: str s3, [sp, #24] - /// CHECK: ldr s3, pc+{{\d+}} (addr {{0x[0-9a-f]+}}) (100) - /// CHECK: end_block - - public void test() { - String r = ""; - - // For the purpose of this regression test, the order of - // definition of these float variable matters. Likewise with the - // order of the instructions where these variables are used below. - // Reordering these lines make make the original (b/32545705) - // issue vanish. - float f17 = b17 ? 0.0f : 1.0f; - float f16 = b16 ? 0.0f : 1.0f; - float f18 = b18 ? 0.0f : 1.0f; - float f19 = b19 ? 0.0f : 1.0f; - float f20 = b20 ? 0.0f : 1.0f; - float f21 = b21 ? 0.0f : 1.0f; - float f15 = b15 ? 0.0f : 1.0f; - float f00 = b00 ? 0.0f : 1.0f; - float f22 = b22 ? 0.0f : 1.0f; - float f23 = b23 ? 0.0f : 1.0f; - float f24 = b24 ? 0.0f : 1.0f; - float f25 = b25 ? 0.0f : 1.0f; - float f26 = b26 ? 0.0f : 1.0f; - float f27 = b27 ? 0.0f : 1.0f; - float f29 = b29 ? 0.0f : 1.0f; - float f28 = b28 ? 0.0f : 1.0f; - float f01 = b01 ? 0.0f : 1.0f; - float f02 = b02 ? 0.0f : 1.0f; - float f03 = b03 ? 0.0f : 1.0f; - float f04 = b04 ? 0.0f : 1.0f; - float f05 = b05 ? 0.0f : 1.0f; - float f07 = b07 ? 0.0f : 1.0f; - float f06 = b06 ? 0.0f : 1.0f; - float f30 = b30 ? 0.0f : 1.0f; - float f31 = b31 ? 0.0f : 1.0f; - float f32 = b32 ? 0.0f : 1.0f; - float f33 = b33 ? 0.0f : 1.0f; - float f34 = b34 ? 0.0f : 1.0f; - float f36 = b36 ? 0.0f : 1.0f; - float f35 = b35 ? 0.0f : 1.0f; - float f08 = b08 ? 0.0f : 1.0f; - float f09 = b09 ? 0.0f : 1.0f; - float f10 = b10 ? 0.0f : 1.0f; - float f11 = b11 ? 0.0f : 1.0f; - float f12 = b12 ? 0.0f : 1.0f; - float f14 = b14 ? 0.0f : 1.0f; - float f13 = b13 ? 0.0f : 1.0f; - - if (conditionA) { - f16 /= 1000.0f; - f17 /= 1000.0f; - f18 /= 1000.0f; - f19 /= 1000.0f; - f20 /= 1000.0f; - f21 /= 1000.0f; - f15 /= 1000.0f; - f08 /= 1000.0f; - f09 /= 1000.0f; - f10 /= 1000.0f; - f11 /= 1000.0f; - f12 /= 1000.0f; - f30 /= 1000.0f; - f31 /= 1000.0f; - f32 /= 1000.0f; - f33 /= 1000.0f; - f34 /= 1000.0f; - f01 /= 1000.0f; - f02 /= 1000.0f; - f03 /= 1000.0f; - f04 /= 1000.0f; - f05 /= 1000.0f; - f23 /= 1000.0f; - f24 /= 1000.0f; - f25 /= 1000.0f; - f26 /= 1000.0f; - f27 /= 1000.0f; - f22 /= 1000.0f; - f00 /= 1000.0f; - f14 /= 1000.0f; - f13 /= 1000.0f; - f36 /= 1000.0f; - f35 /= 1000.0f; - f07 /= 1000.0f; - f06 /= 1000.0f; - f29 /= 1000.0f; - f28 /= 1000.0f; - } - // The parallel move that used to exhaust the ARM64 parallel move - // resolver's scratch register pool (provided by VIXL) was in the - // "else" branch of the following condition generated by ART's - // compiler. - if (conditionB) { - f16 /= 100.0f; - f17 /= 100.0f; - f18 /= 100.0f; - f19 /= 100.0f; - f20 /= 100.0f; - f21 /= 100.0f; - f15 /= 100.0f; - f08 /= 100.0f; - f09 /= 100.0f; - f10 /= 100.0f; - f11 /= 100.0f; - f12 /= 100.0f; - f30 /= 100.0f; - f31 /= 100.0f; - f32 /= 100.0f; - f33 /= 100.0f; - f34 /= 100.0f; - f01 /= 100.0f; - f02 /= 100.0f; - f03 /= 100.0f; - f04 /= 100.0f; - f05 /= 100.0f; - f23 /= 100.0f; - f24 /= 100.0f; - f25 /= 100.0f; - f26 /= 100.0f; - f27 /= 100.0f; - f22 /= 100.0f; - f00 /= 100.0f; - f14 /= 100.0f; - f13 /= 100.0f; - f36 /= 100.0f; - f35 /= 100.0f; - f07 /= 100.0f; - f06 /= 100.0f; - f29 /= 100.0f; - f28 /= 100.0f; - } - if (conditionC) { - f16 /= 12.0f; - f17 /= 12.0f; - f18 /= 12.0f; - f19 /= 12.0f; - f20 /= 12.0f; - f21 /= 12.0f; - f15 /= 12.0f; - f08 /= 12.0f; - f09 /= 12.0f; - f10 /= 12.0f; - f11 /= 12.0f; - f12 /= 12.0f; - f30 /= 12.0f; - f31 /= 12.0f; - f32 /= 12.0f; - f33 /= 12.0f; - f34 /= 12.0f; - f01 /= 12.0f; - f02 /= 12.0f; - f03 /= 12.0f; - f04 /= 12.0f; - f05 /= 12.0f; - f23 /= 12.0f; - f24 /= 12.0f; - f25 /= 12.0f; - f26 /= 12.0f; - f27 /= 12.0f; - f22 /= 12.0f; - f00 /= 12.0f; - f14 /= 12.0f; - f13 /= 12.0f; - f36 /= 12.0f; - f35 /= 12.0f; - f07 /= 12.0f; - f06 /= 12.0f; - f29 /= 12.0f; - f28 /= 12.0f; - } - float s = 0.0f; - s = ((float) Math.round(100.0f * s)) / 100.0f; - String res = s + r; - } - public static void main(String[] args) { - Main main = new Main(); - main.test(); System.out.println("passed"); } } diff --git a/test/639-checker-code-sinking/src/Main.java b/test/639-checker-code-sinking/src/Main.java index a1c30f7b4e..8efac92c34 100644 --- a/test/639-checker-code-sinking/src/Main.java +++ b/test/639-checker-code-sinking/src/Main.java @@ -343,6 +343,37 @@ public class Main { } } + static native void doStaticNativeCallLiveVreg(); + + // Test ensures that 'o' has been moved into the if despite the InvokeStaticOrDirect. + // + /// CHECK-START: void Main.testSinkingOverInvoke() code_sinking (before) + /// CHECK: <<Int1:i\d+>> IntConstant 1 + /// CHECK: <<Int0:i\d+>> IntConstant 0 + /// CHECK: <<LoadClass:l\d+>> LoadClass class_name:java.lang.Object[] + /// CHECK-NOT: begin_block + /// CHECK: NewArray [<<LoadClass>>,<<Int1>>] + /// CHECK: If + /// CHECK: begin_block + /// CHECK: Throw + + /// CHECK-START: void Main.testSinkingOverInvoke() code_sinking (after) + /// CHECK: <<Int1:i\d+>> IntConstant 1 + /// CHECK: <<Int0:i\d+>> IntConstant 0 + /// CHECK: If + /// CHECK: begin_block + /// CHECK: <<LoadClass:l\d+>> LoadClass class_name:java.lang.Object[] + /// CHECK: NewArray [<<LoadClass>>,<<Int1>>] + /// CHECK: Throw + static void testSinkingOverInvoke() { + Object[] o = new Object[1]; + o[0] = o; + doStaticNativeCallLiveVreg(); + if (doThrow) { + throw new Error(o.toString()); + } + } + public String $opt$noinline$toString() { return "" + intField; } diff --git a/test/646-checker-hadd-alt-char/build b/test/646-checker-hadd-alt-char/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/646-checker-hadd-alt-char/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/646-checker-hadd-alt-char/src/Main.java b/test/646-checker-hadd-alt-char/src/Main.java index 2a1382dfde..79904ce74f 100644 --- a/test/646-checker-hadd-alt-char/src/Main.java +++ b/test/646-checker-hadd-alt-char/src/Main.java @@ -58,7 +58,7 @@ public class Main { /// CHECK-DAG: <<Get1:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<IMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<IMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<IMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Add>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Cnv:c\d+>> TypeConversion [<<UShr>>] loop:<<Loop>> outer_loop:none @@ -120,7 +120,7 @@ public class Main { /// CHECK-DAG: <<Get1:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<IMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<IMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<IMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add1:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add2:i\d+>> Add [<<Add1>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Add2>>,<<I1>>] loop:<<Loop>> outer_loop:none diff --git a/test/646-checker-hadd-alt-short/build b/test/646-checker-hadd-alt-short/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/646-checker-hadd-alt-short/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/646-checker-hadd-alt-short/src/Main.java b/test/646-checker-hadd-alt-short/src/Main.java index 4035b97209..1ecb1d8273 100644 --- a/test/646-checker-hadd-alt-short/src/Main.java +++ b/test/646-checker-hadd-alt-short/src/Main.java @@ -58,7 +58,7 @@ public class Main { /// CHECK-DAG: <<Get1:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<UMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<UMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<UMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Add>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Cnv:s\d+>> TypeConversion [<<UShr>>] loop:<<Loop>> outer_loop:none @@ -82,7 +82,9 @@ public class Main { private static void halving_add_unsigned(short[] b1, short[] b2, short[] bo) { int min_length = Math.min(bo.length, Math.min(b1.length, b2.length)); for (int i = 0; i < min_length; i++) { - bo[i] = (short) (((b1[i] & 0xffff) + (b2[i] & 0xffff)) >>> 1); + int v1 = b1[i] & 0xffff; + int v2 = b2[i] & 0xffff; + bo[i] = (short) ((v1 + v2) >>> 1); } } @@ -116,7 +118,7 @@ public class Main { /// CHECK-DAG: <<Get1:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<UMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<UMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<UMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add1:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add2:i\d+>> Add [<<Add1>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Add2>>,<<I1>>] loop:<<Loop>> outer_loop:none @@ -142,7 +144,9 @@ public class Main { private static void rounding_halving_add_unsigned(short[] b1, short[] b2, short[] bo) { int min_length = Math.min(bo.length, Math.min(b1.length, b2.length)); for (int i = 0; i < min_length; i++) { - bo[i] = (short) (((b1[i] & 0xffff) + (b2[i] & 0xffff) + 1) >>> 1); + int v1 = b1[i] & 0xffff; + int v2 = b2[i] & 0xffff; + bo[i] = (short) ((v1 + v2 + 1) >>> 1); } } diff --git a/test/646-checker-hadd-char/build b/test/646-checker-hadd-char/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/646-checker-hadd-char/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/646-checker-hadd-char/src/Main.java b/test/646-checker-hadd-char/src/Main.java index 6549dab9ff..cbe629711f 100644 --- a/test/646-checker-hadd-char/src/Main.java +++ b/test/646-checker-hadd-char/src/Main.java @@ -67,7 +67,7 @@ public class Main { /// CHECK-DAG: <<Get1:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<IMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<IMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<IMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Add>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Cnv:c\d+>> TypeConversion [<<Shr>>] loop:<<Loop>> outer_loop:none @@ -152,7 +152,7 @@ public class Main { /// CHECK-DAG: <<Get1:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:c\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<IMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<IMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<IMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add1:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add2:i\d+>> Add [<<Add1>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Add2>>,<<I1>>] loop:<<Loop>> outer_loop:none diff --git a/test/646-checker-hadd-short/build b/test/646-checker-hadd-short/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/646-checker-hadd-short/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/646-checker-hadd-short/src/Main.java b/test/646-checker-hadd-short/src/Main.java index c09da8125b..d78a678dc8 100644 --- a/test/646-checker-hadd-short/src/Main.java +++ b/test/646-checker-hadd-short/src/Main.java @@ -86,7 +86,7 @@ public class Main { /// CHECK-DAG: <<Get1:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<UMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<UMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<UMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Add>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Cnv:s\d+>> TypeConversion [<<Shr>>] loop:<<Loop>> outer_loop:none @@ -110,7 +110,9 @@ public class Main { private static void halving_add_unsigned(short[] b1, short[] b2, short[] bo) { int min_length = Math.min(bo.length, Math.min(b1.length, b2.length)); for (int i = 0; i < min_length; i++) { - bo[i] = (short) (((b1[i] & 0xffff) + (b2[i] & 0xffff)) >> 1); + int v1 = b1[i] & 0xffff; + int v2 = b2[i] & 0xffff; + bo[i] = (short) ((v1 + v2) >> 1); } } @@ -224,7 +226,7 @@ public class Main { /// CHECK-DAG: <<Get1:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<UMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<UMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<UMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add1:i\d+>> Add [<<And1>>,<<And2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add2:i\d+>> Add [<<Add1>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Add2>>,<<I1>>] loop:<<Loop>> outer_loop:none @@ -250,7 +252,9 @@ public class Main { private static void rounding_halving_add_unsigned(short[] b1, short[] b2, short[] bo) { int min_length = Math.min(bo.length, Math.min(b1.length, b2.length)); for (int i = 0; i < min_length; i++) { - bo[i] = (short) (((b1[i] & 0xffff) + (b2[i] & 0xffff) + 1) >> 1); + int v1 = b1[i] & 0xffff; + int v2 = b2[i] & 0xffff; + bo[i] = (short) ((v1 + v2 + 1) >> 1); } } @@ -261,9 +265,9 @@ public class Main { /// CHECK-DAG: <<Get1:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<And1:i\d+>> And [<<Get1>>,<<UMAX>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<And2:i\d+>> And [<<Get2>>,<<UMAX>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<And2:i\d+>> And [<<UMAX>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add1:i\d+>> Add [<<And2>>,<<I1>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<Add2:i\d+>> Add [<<And1>>,<<Add1>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Add2:i\d+>> Add [<<Add1>>,<<And1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Add2>>,<<I1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Cnv:s\d+>> TypeConversion [<<Shr>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: ArraySet [{{l\d+}},{{i\d+}},<<Cnv>>] loop:<<Loop>> outer_loop:none @@ -288,7 +292,9 @@ public class Main { int min_length = Math.min(bo.length, Math.min(b1.length, b2.length)); for (int i = 0; i < min_length; i++) { // Slightly different order in idiom does not confuse recognition. - bo[i] = (short) ((b1[i] & 0xffff) + ((b2[i] & 0xffff) + 1) >> 1); + int v1 = b1[i] & 0xffff; + int v2 = b2[i] & 0xffff; + bo[i] = (short) (v1 + (v2 + 1) >> 1); } } diff --git a/test/660-checker-simd-sad-byte/build b/test/660-checker-simd-sad-byte/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/660-checker-simd-sad-byte/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/660-checker-simd-sad-byte/src/Main.java b/test/660-checker-simd-sad-byte/src/Main.java index 778d55c3ce..38003d18c6 100644 --- a/test/660-checker-simd-sad-byte/src/Main.java +++ b/test/660-checker-simd-sad-byte/src/Main.java @@ -90,8 +90,8 @@ public class Main { /// CHECK-START: int Main.sadByte2Int(byte[], byte[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:b\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:b\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none @@ -121,8 +121,8 @@ public class Main { /// CHECK-START: int Main.sadByte2IntAlt(byte[], byte[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:b\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:b\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get2>>,<<Get1>>] loop:<<Loop>> outer_loop:none @@ -154,8 +154,8 @@ public class Main { /// CHECK-START: int Main.sadByte2IntAlt2(byte[], byte[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:b\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:b\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none diff --git a/test/660-checker-simd-sad-char/build b/test/660-checker-simd-sad-char/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/660-checker-simd-sad-char/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/660-checker-simd-sad-char/src/Main.java b/test/660-checker-simd-sad-char/src/Main.java index 91c92f1179..18ae024231 100644 --- a/test/660-checker-simd-sad-char/src/Main.java +++ b/test/660-checker-simd-sad-char/src/Main.java @@ -59,8 +59,8 @@ public class Main { /// CHECK-START: int Main.sadChar2Int(char[], char[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none @@ -82,8 +82,8 @@ public class Main { /// CHECK-START: int Main.sadChar2IntAlt(char[], char[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get2>>,<<Get1>>] loop:<<Loop>> outer_loop:none @@ -107,8 +107,8 @@ public class Main { /// CHECK-START: int Main.sadChar2IntAlt2(char[], char[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none diff --git a/test/660-checker-simd-sad-int/build b/test/660-checker-simd-sad-int/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/660-checker-simd-sad-int/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/660-checker-simd-sad-int/src/Main.java b/test/660-checker-simd-sad-int/src/Main.java index 29415fd2cf..5952c41c2d 100644 --- a/test/660-checker-simd-sad-int/src/Main.java +++ b/test/660-checker-simd-sad-int/src/Main.java @@ -22,8 +22,8 @@ public class Main { /// CHECK-START: int Main.sadInt2Int(int[], int[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:i\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:i\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none @@ -51,8 +51,8 @@ public class Main { /// CHECK-START: int Main.sadInt2IntAlt(int[], int[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:i\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:i\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub1:i\d+>> Sub [<<Get2>>,<<Get1>>] loop:<<Loop>> outer_loop:none @@ -79,8 +79,8 @@ public class Main { /// CHECK-START: int Main.sadInt2IntAlt2(int[], int[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:i\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:i\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none diff --git a/test/660-checker-simd-sad-short/build b/test/660-checker-simd-sad-short/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/660-checker-simd-sad-short/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/660-checker-simd-sad-short/src/Main.java b/test/660-checker-simd-sad-short/src/Main.java index 77c9e53e0c..ff74559292 100644 --- a/test/660-checker-simd-sad-short/src/Main.java +++ b/test/660-checker-simd-sad-short/src/Main.java @@ -61,8 +61,8 @@ public class Main { /// CHECK-START: int Main.sadShort2Int(short[], short[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none @@ -92,8 +92,8 @@ public class Main { /// CHECK-START: int Main.sadShort2IntAlt(short[], short[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get2>>,<<Get1>>] loop:<<Loop>> outer_loop:none @@ -125,8 +125,8 @@ public class Main { /// CHECK-START: int Main.sadShort2IntAlt2(short[], short[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none @@ -161,8 +161,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<Cons:i\d+>> IntConstant -7 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> Add [<<Get1>>,<<Cons>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Add>>] loop:<<Loop>> outer_loop:none @@ -193,8 +193,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<Cons:i\d+>> IntConstant 7 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Cons>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none @@ -225,8 +225,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<Cons:i\d+>> IntConstant 7 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> Add [<<Get1>>,<<Cons>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Add>>] loop:<<Loop>> outer_loop:none diff --git a/test/660-checker-simd-sad-short2/build b/test/660-checker-simd-sad-short2/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/660-checker-simd-sad-short2/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/660-checker-simd-sad-short2/src/Main.java b/test/660-checker-simd-sad-short2/src/Main.java index a1f98297c5..1ce0e2a266 100644 --- a/test/660-checker-simd-sad-short2/src/Main.java +++ b/test/660-checker-simd-sad-short2/src/Main.java @@ -59,8 +59,8 @@ public class Main { /// CHECK-START: int Main.sadCastedChar2Int(char[], char[]) instruction_simplifier (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<BC1:i\d+>> BoundsCheck [<<Phi1>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<BC2:i\d+>> BoundsCheck [<<Phi1>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<BC1>>] loop:<<Loop>> outer_loop:none @@ -75,8 +75,8 @@ public class Main { /// CHECK-START: int Main.sadCastedChar2Int(char[], char[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none @@ -106,8 +106,8 @@ public class Main { /// CHECK-START: int Main.sadCastedChar2IntAlt(char[], char[]) instruction_simplifier (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<BC1:i\d+>> BoundsCheck [<<Phi1>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<BC2:i\d+>> BoundsCheck [<<Phi1>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<BC1>>] loop:<<Loop>> outer_loop:none @@ -123,13 +123,11 @@ public class Main { /// CHECK-START: int Main.sadCastedChar2IntAlt(char[], char[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none - // Note: Get1+Cnv1 not simplified yet due to env use of Get1 in NullCheck for s2[i]. - /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<Cnv1:s\d+>> TypeConversion [<<Get1>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get2>>,<<Cnv1>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get2>>,<<Get1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: Add [<<Phi2>>,<<Intrin>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: Add [<<Phi1>>,<<Cons1>>] loop:<<Loop>> outer_loop:none @@ -158,8 +156,8 @@ public class Main { /// CHECK-START: int Main.sadCastedChar2IntAlt2(char[], char[]) instruction_simplifier (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<BC1:\i\d+>> BoundsCheck [<<Phi1>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<BC2:\i\d+>> BoundsCheck [<<Phi1>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<BC1>>] loop:<<Loop>> outer_loop:none @@ -175,13 +173,11 @@ public class Main { /// CHECK-START: int Main.sadCastedChar2IntAlt2(char[], char[]) loop_optimization (before) /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none - // Note: Get1+Cnv1 not simplified yet due to env use of Get1 in NullCheck for s2[i]. - /// CHECK-DAG: <<Get1:c\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Get1:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get2:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<Cnv1:s\d+>> TypeConversion [<<Get1>>] loop:<<Loop>> outer_loop:none - /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Cnv1>>,<<Get2>>] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get1>>,<<Get2>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: Add [<<Phi2>>,<<Intrin>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: Add [<<Phi1>>,<<Cons1>>] loop:<<Loop>> outer_loop:none diff --git a/test/660-checker-simd-sad-short3/build b/test/660-checker-simd-sad-short3/build deleted file mode 100644 index d85147f17b..0000000000 --- a/test/660-checker-simd-sad-short3/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/660-checker-simd-sad-short3/src/Main.java b/test/660-checker-simd-sad-short3/src/Main.java index 877a5362ce..d0892c37c8 100644 --- a/test/660-checker-simd-sad-short3/src/Main.java +++ b/test/660-checker-simd-sad-short3/src/Main.java @@ -25,8 +25,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<Param:s\d+>> ParameterValue loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get>>,<<Param>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none @@ -56,8 +56,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<Param:s\d+>> ParameterValue loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Param>>,<<Get>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none @@ -87,8 +87,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<ConsI:i\d+>> IntConstant -32767 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> Add [<<Get>>,<<ConsI>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Add>>] loop:<<Loop>> outer_loop:none @@ -118,8 +118,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<ConsI:i\d+>> IntConstant 32767 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<ConsI>>,<<Get>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none @@ -149,8 +149,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<Conv:s\d+>> TypeConversion [{{i\d+}}] loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Get>>,<<Conv>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none @@ -181,8 +181,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<Conv:s\d+>> TypeConversion [{{i\d+}}] loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Conv>>,<<Get>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Intrin:i\d+>> Abs [<<Sub>>] loop:<<Loop>> outer_loop:none @@ -213,8 +213,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<ConsI:i\d+>> IntConstant 110 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> [<<Get>>,<<ConsI>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Conv:s\d+>> TypeConversion [<<Add>>] loop:<<Loop>> outer_loop:none @@ -248,8 +248,8 @@ public class Main { /// CHECK-DAG: <<Cons0:i\d+>> IntConstant 0 loop:none /// CHECK-DAG: <<Cons1:i\d+>> IntConstant 1 loop:none /// CHECK-DAG: <<ConsI:i\d+>> IntConstant 110 loop:none - /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none - /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none + /// CHECK-DAG: <<Phi2:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop:B\d+>> outer_loop:none + /// CHECK-DAG: <<Phi1:i\d+>> Phi [<<Cons0>>,{{i\d+}}] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Get:s\d+>> ArrayGet [{{l\d+}},<<Phi1>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Add:i\d+>> [<<Get>>,<<ConsI>>] loop:<<Loop>> outer_loop:none /// CHECK-DAG: <<Conv:s\d+>> TypeConversion [<<Add>>] loop:<<Loop>> outer_loop:none diff --git a/test/679-checker-minmax/src/Main.java b/test/679-checker-minmax/src/Main.java index abf8c279da..4b7265642a 100644 --- a/test/679-checker-minmax/src/Main.java +++ b/test/679-checker-minmax/src/Main.java @@ -37,6 +37,13 @@ public class Main { // /// CHECK-START: int Main.minI(int) instruction_simplifier (after) /// CHECK-NOT: InvokeStaticOrDirect + // + /// CHECK-START-ARM64: int Main.minI(int) disassembly (after) + /// CHECK-NOT: mov {{w\d+}}, #0x14 + /// CHECK: cmp {{w\d+}}, #0x14 + // Check that the constant generation was handled by VIXL. + /// CHECK: mov w16, #0x14 + /// CHECK: csel {{w\d+}}, {{w\d+}}, w16, lt public static int minI(int a) { return Math.min(a, 20); } @@ -55,6 +62,13 @@ public class Main { // /// CHECK-START: long Main.minL(long) instruction_simplifier (after) /// CHECK-NOT: InvokeStaticOrDirect + // + /// CHECK-START-ARM64: long Main.minL(long) disassembly (after) + /// CHECK-NOT: mov {{x\d+}}, #0x14 + /// CHECK: cmp {{x\d+}}, #0x14 + // Check that the constant generation was handled by VIXL. + /// CHECK: mov x16, #0x14 + /// CHECK: csel {{x\d+}}, {{x\d+}}, x16, lt public static long minL(long a) { return Math.min(a, 20L); } @@ -73,6 +87,13 @@ public class Main { // /// CHECK-START: int Main.maxI(int) instruction_simplifier (after) /// CHECK-NOT: InvokeStaticOrDirect + // + /// CHECK-START-ARM64: int Main.maxI(int) disassembly (after) + /// CHECK-NOT: mov {{w\d+}}, #0x14 + /// CHECK: cmp {{w\d+}}, #0x14 + // Check that the constant generation was handled by VIXL. + /// CHECK: mov w16, #0x14 + /// CHECK: csel {{w\d+}}, {{w\d+}}, w16, gt public static int maxI(int a) { return Math.max(a, 20); } @@ -91,11 +112,166 @@ public class Main { // /// CHECK-START: long Main.maxL(long) instruction_simplifier (after) /// CHECK-NOT: InvokeStaticOrDirect + // + /// CHECK-START-ARM64: long Main.maxL(long) disassembly (after) + /// CHECK-NOT: mov {{x\d+}}, #0x14 + /// CHECK: cmp {{x\d+}}, #0x14 + // Check that the constant generation was handled by VIXL. + /// CHECK: mov x16, #0x14 + /// CHECK: csel {{x\d+}}, {{x\d+}}, x16, gt public static long maxL(long a) { return Math.max(a, 20L); } // + // Special Cases + // + + /// CHECK-START-ARM64: int Main.minIntConstantZero(int) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{w\d+}}, #0x0 + /// CHECK: cmp {{w\d+}}, #0x0 (0) + /// CHECK: csel {{w\d+}}, {{w\d+}}, wzr, lt + /// CHECK: ret + public static int minIntConstantZero(int a) { + return Math.min(a, 0); + } + + /// CHECK-START-ARM64: int Main.minIntConstantOne(int) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{w\d+}}, #0x1 + /// CHECK: cmp {{w\d+}}, #0x1 (1) + /// CHECK: csinc {{w\d+}}, {{w\d+}}, wzr, lt + /// CHECK: ret + public static int minIntConstantOne(int a) { + return Math.min(a, 1); + } + + /// CHECK-START-ARM64: int Main.minIntConstantMinusOne(int) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{w\d+}}, #0xffffffff + /// CHECK: cmn {{w\d+}}, #0x1 (1) + /// CHECK: csinv {{w\d+}}, {{w\d+}}, wzr, lt + /// CHECK: ret + public static int minIntConstantMinusOne(int a) { + return Math.min(a, -1); + } + + /// CHECK-START-ARM64: long Main.minLongConstantZero(long) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{x\d+}}, #0x0 + /// CHECK: cmp {{x\d+}}, #0x0 (0) + /// CHECK: csel {{x\d+}}, {{x\d+}}, xzr, lt + /// CHECK: ret + public static long minLongConstantZero(long a) { + return Math.min(a, 0L); + } + + /// CHECK-START-ARM64: long Main.minLongConstantOne(long) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{x\d+}}, #0x1 + /// CHECK: cmp {{x\d+}}, #0x1 (1) + /// CHECK: csinc {{x\d+}}, {{x\d+}}, xzr, lt + /// CHECK: ret + public static long minLongConstantOne(long a) { + return Math.min(a, 1L); + } + + /// CHECK-START-ARM64: long Main.minLongConstantMinusOne(long) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{x\d+}}, #0xffffffffffffffff + /// CHECK: cmn {{x\d+}}, #0x1 (1) + /// CHECK: csinv {{x\d+}}, {{x\d+}}, xzr, lt + /// CHECK: ret + public static long minLongConstantMinusOne(long a) { + return Math.min(a, -1L); + } + + /// CHECK-START-ARM64: int Main.maxIntConstantZero(int) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{w\d+}}, #0x0 + /// CHECK: cmp {{w\d+}}, #0x0 (0) + /// CHECK: csel {{w\d+}}, {{w\d+}}, wzr, gt + /// CHECK: ret + public static int maxIntConstantZero(int a) { + return Math.max(a, 0); + } + + /// CHECK-START-ARM64: int Main.maxIntConstantOne(int) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{w\d+}}, #0x1 + /// CHECK: cmp {{w\d+}}, #0x1 (1) + /// CHECK: csinc {{w\d+}}, {{w\d+}}, wzr, gt + /// CHECK: ret + public static int maxIntConstantOne(int a) { + return Math.max(a, 1); + } + + /// CHECK-START-ARM64: int Main.maxIntConstantMinusOne(int) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{w\d+}}, #0xffffffff + /// CHECK: cmn {{w\d+}}, #0x1 (1) + /// CHECK: csinv {{w\d+}}, {{w\d+}}, wzr, gt + /// CHECK: ret + public static int maxIntConstantMinusOne(int a) { + return Math.max(a, -1); + } + + /// CHECK-START-ARM64: int Main.maxIntLargeConstant(int) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK: mov {{w\d+}}, #0x2001 + /// CHECK: cmp {{w\d+}}, {{w\d+}} + // Check that constant generation was not handled by VIXL. + /// CHECK-NOT: mov {{w\d+}}, #0x2001 + /// CHECK: csel {{w\d+}}, {{w\d+}}, {{w\d+}}, gt + /// CHECK: ret + public static int maxIntLargeConstant(int a) { + return Math.max(a, 8193); + } + + /// CHECK-START-ARM64: long Main.maxLongConstantZero(long) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{x\d+}}, #0x0 + /// CHECK: cmp {{x\d+}}, #0x0 (0) + /// CHECK: csel {{x\d+}}, {{x\d+}}, xzr, gt + /// CHECK: ret + public static long maxLongConstantZero(long a) { + return Math.max(a, 0L); + } + + /// CHECK-START-ARM64: long Main.maxLongConstantOne(long) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{x\d+}}, #0x1 + /// CHECK: cmp {{x\d+}}, #0x1 (1) + /// CHECK: csinc {{x\d+}}, {{x\d+}}, xzr, gt + /// CHECK: ret + public static long maxLongConstantOne(long a) { + return Math.max(a, 1L); + } + + /// CHECK-START-ARM64: long Main.maxLongConstantMinusOne(long) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK-NOT: mov {{x\d+}}, #0xffffffffffffffff + /// CHECK: cmn {{x\d+}}, #0x1 (1) + /// CHECK: csinv {{x\d+}}, {{x\d+}}, xzr, gt + /// CHECK: ret + public static long maxLongConstantMinusOne(long a) { + return Math.max(a, -1L); + } + + /// CHECK-START-ARM64: long Main.maxLongLargeConstant(long) disassembly (after) + /// CHECK-NOT: InvokeStaticOrDirect + /// CHECK: mov {{x\d+}}, #0x2001 + /// CHECK: cmp {{x\d+}}, {{x\d+}} + // Check that constant generation was not handled by VIXL. + /// CHECK-NOT: mov {{x\d+}}, #0x2001 + /// CHECK: csel {{x\d+}}, {{x\d+}}, {{x\d+}}, gt + /// CHECK: ret + public static long maxLongLargeConstant(long a) { + return Math.max(a, 8193L); + } + + // // Different types. // @@ -538,12 +714,40 @@ public class Main { // Intrinsics. expectEquals(10, minI(10)); expectEquals(20, minI(25)); + expectEquals(-1, minIntConstantZero(-1)); + expectEquals(0, minIntConstantZero(1)); + expectEquals(0, minIntConstantOne(0)); + expectEquals(1, minIntConstantOne(2)); + expectEquals(-2, minIntConstantMinusOne(-2)); + expectEquals(-1, minIntConstantMinusOne(0)); expectEquals(10L, minL(10L)); expectEquals(20L, minL(25L)); + expectEquals(-1L, minLongConstantZero(-1L)); + expectEquals(0L, minLongConstantZero(1L)); + expectEquals(0L, minLongConstantOne(0L)); + expectEquals(1L, minLongConstantOne(2L)); + expectEquals(-2L, minLongConstantMinusOne(-2L)); + expectEquals(-1L, minLongConstantMinusOne(0L)); expectEquals(20, maxI(10)); expectEquals(25, maxI(25)); + expectEquals(0, maxIntConstantZero(-1)); + expectEquals(1, maxIntConstantZero(1)); + expectEquals(1, maxIntConstantOne(0)); + expectEquals(2, maxIntConstantOne(2)); + expectEquals(-1, maxIntConstantMinusOne(-2)); + expectEquals(0, maxIntConstantMinusOne(0)); + expectEquals(8193, maxIntLargeConstant(8192)); + expectEquals(9000, maxIntLargeConstant(9000)); expectEquals(20L, maxL(10L)); expectEquals(25L, maxL(25L)); + expectEquals(0L, maxLongConstantZero(-1L)); + expectEquals(1L, maxLongConstantZero(1L)); + expectEquals(1L, maxLongConstantOne(0L)); + expectEquals(2L, maxLongConstantOne(2L)); + expectEquals(-1L, maxLongConstantMinusOne(-2L)); + expectEquals(0L, maxLongConstantMinusOne(0L)); + expectEquals(8193L, maxLongLargeConstant(8192L)); + expectEquals(9000L, maxLongLargeConstant(9000L)); // Types. expectEquals(10, min1(10, 20)); expectEquals(10, min2(10, 20)); diff --git a/test/952-invoke-custom/build b/test/952-invoke-custom/build index 2caca94d7f..53d8228808 100755 --- a/test/952-invoke-custom/build +++ b/test/952-invoke-custom/build @@ -21,11 +21,6 @@ ASM_JAR="${ANDROID_BUILD_TOP}/prebuilts/misc/common/asm/asm-6.0.jar" INTERMEDIATE_CLASSES=classes-intermediate CLASSES=classes -DEXER="${DX:-dx}" -if [ "${USE_D8=false}" = "true" ]; then - DEXER="${ANDROID_HOST_OUT}/bin/d8-compat-dx" -fi - # Create directory for intermediate classes rm -rf "${INTERMEDIATE_CLASSES}" mkdir "${INTERMEDIATE_CLASSES}" @@ -46,7 +41,7 @@ done # Create DEX DX_FLAGS="${DX_FLAGS} --min-sdk-version=26 --debug --dump-width=1000" -${DEXER} -JXmx256m --dex ${DX_FLAGS} --dump-to=${CLASSES}.lst --output=classes.dex ${CLASSES} +${DX} -JXmx256m --dex ${DX_FLAGS} --output=classes.dex ${CLASSES} # Zip DEX to file name expected by test runner zip ${TEST_NAME:-classes-dex}.jar classes.dex diff --git a/test/979-const-method-handle/build b/test/979-const-method-handle/build index ce931a96d1..67fc2a6339 100755 --- a/test/979-const-method-handle/build +++ b/test/979-const-method-handle/build @@ -22,11 +22,6 @@ INTERMEDIATE_CLASSES=classes-intermediate TRANSFORMER_CLASSES=classes-transformer CLASSES=classes -DEXER="${DX:-dx}" -if [ "${USE_D8=false}" = "true" ]; then - DEXER="${ANDROID_HOST_OUT}/bin/d8-compat-dx" -fi - # Create directories for classes for class_dir in "${INTERMEDIATE_CLASSES}" "${TRANSFORMER_CLASSES}" "${CLASSES}"; do rm -rf "${class_dir}" @@ -49,7 +44,7 @@ done # Create DEX DX_FLAGS="${DX_FLAGS} --min-sdk-version=28 --debug --dump-width=1000" -${DEXER} -JXmx256m --dex ${DX_FLAGS} --dump-to=${CLASSES}.lst --output=classes.dex ${CLASSES} ${TRANSFORMER_CLASSES} +${DX} -JXmx256m --dex ${DX_FLAGS} --output=classes.dex ${CLASSES} ${TRANSFORMER_CLASSES} # Zip DEX to file name expected by test runner zip ${TEST_NAME:-classes-dex}.jar classes.dex diff --git a/test/etc/default-build b/test/etc/default-build index 9dbc73c6b4..c8993c6611 100755 --- a/test/etc/default-build +++ b/test/etc/default-build @@ -307,7 +307,7 @@ function make_dex() { fi # Make dex file from desugared JAR. - ${dexer} -JXmx256m ${DX_VM_FLAGS} --debug --dex --dump-to=${name}.lst --output=${name}.dex --dump-width=1000 ${DX_FLAGS} "${dx_input}" + ${dexer} -JXmx256m ${DX_VM_FLAGS} --debug --dex --output=${name}.dex ${DX_FLAGS} "${dx_input}" } # Merge all the dex files in $1..$N into $1. Skip non-existing files, but at least 1 file must exist. diff --git a/test/run-test b/test/run-test index 5bd8b3b348..b5b42854e5 100755 --- a/test/run-test +++ b/test/run-test @@ -529,12 +529,27 @@ fi # Most interesting target architecture variables are Makefile variables, not environment variables. # Try to map the suffix64 flag and what we find in ${ANDROID_PRODUCT_OUT}/data/art-test to an architecture name. function guess_target_arch_name() { - grep32bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm|x86|mips)$'` - grep64bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm64|x86_64|mips64)$'` - if [ "x${suffix64}" = "x64" ]; then - target_arch_name=${grep64bit} + # Check whether this is a device with native bridge. Currently this is hardcoded + # to x86 + arm. + x86_arm=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | sort | grep -E '^(arm|x86)$'` + # Collapse line-breaks into spaces + x86_arm=$(echo $x86_arm) + if [ "x$x86_arm" = "xarm x86" ] ; then + err_echo "Native-bridge configuration detected." + # We only support the main arch for tests. + if [ "x${suffix64}" = "x64" ]; then + target_arch_name="" + else + target_arch_name=x86 + fi else - target_arch_name=${grep32bit} + grep32bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm|x86|mips)$'` + grep64bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm64|x86_64|mips64)$'` + if [ "x${suffix64}" = "x64" ]; then + target_arch_name=${grep64bit} + else + target_arch_name=${grep32bit} + fi fi } diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py index 067e678ca1..e8d4290d28 100755 --- a/test/testrunner/testrunner.py +++ b/test/testrunner/testrunner.py @@ -328,7 +328,7 @@ def run_tests(tests): if gdb_arg: options_all += ' --gdb-arg ' + gdb_arg - options_all += ' '.join(run_test_option) + options_all += ' ' + ' '.join(run_test_option) if runtime_option: for opt in runtime_option: @@ -1010,11 +1010,11 @@ def main(): if build: build_targets = '' if 'host' in _user_input_variants['target']: - build_targets += 'test-art-host-run-test-dependencies' + build_targets += 'test-art-host-run-test-dependencies ' if 'target' in _user_input_variants['target']: - build_targets += 'test-art-target-run-test-dependencies' + build_targets += 'test-art-target-run-test-dependencies ' if 'jvm' in _user_input_variants['target']: - build_targets += 'test-art-host-run-test-dependencies' + build_targets += 'test-art-host-run-test-dependencies ' build_command = 'make' build_command += ' DX=' build_command += ' -j' |