ART: Run arch specific Checker tests on host

The run-test script would not pass an architecture to Checker when
not in target mode and tests specific to x86(_64) would therefore not
be run.

Change-Id: Ibcbad0135e7a870e6ad3f09ab612fe276c97bcb8
diff --git a/test/526-checker-caller-callee-regs/src/Main.java b/test/526-checker-caller-callee-regs/src/Main.java
index a1f3301..f402c2c 100644
--- a/test/526-checker-caller-callee-regs/src/Main.java
+++ b/test/526-checker-caller-callee-regs/src/Main.java
@@ -36,6 +36,8 @@
   // ------------------------------|------------------------|-----------------
   // ARM64 callee-saved registers  | [x20-x29]              | x2[0-9]
   // ARM callee-saved registers    | [r5-r8,r10,r11]        | r([5-8]|10|11)
+  // X86 callee-saved registers    | [ebp,esi,edi]          | e(bp|si|di)
+  // X86_64 callee-saved registers | [rbx,rbp,r12-15]       | r(bx|bp|1[2-5])
 
   /**
    * Check that a value live across a function call is allocated in a callee
@@ -58,7 +60,21 @@
   /// CHECK:                        Sub [<<t1>>,<<t2>>]
   /// CHECK:                        Return
 
-  // TODO: Add tests for other architectures.
+  /// CHECK-START-X86: int Main.$opt$LiveInCall(int) register (after)
+  /// CHECK-DAG:   <<Arg:i\d+>>     ParameterValue
+  /// CHECK-DAG:   <<Const1:i\d+>>  IntConstant 1
+  /// CHECK:       <<t1:i\d+>>      Add [<<Arg>>,<<Const1>>] {{.*->e(bp|si|di)}}
+  /// CHECK:       <<t2:i\d+>>      InvokeStaticOrDirect
+  /// CHECK:                        Sub [<<t1>>,<<t2>>]
+  /// CHECK:                        Return
+
+  /// CHECK-START-X86_64: int Main.$opt$LiveInCall(int) register (after)
+  /// CHECK-DAG:   <<Arg:i\d+>>     ParameterValue
+  /// CHECK-DAG:   <<Const1:i\d+>>  IntConstant 1
+  /// CHECK:       <<t1:i\d+>>      Add [<<Arg>>,<<Const1>>] {{.*->r(bx|bp|1[2-5])}}
+  /// CHECK:       <<t2:i\d+>>      InvokeStaticOrDirect
+  /// CHECK:                        Sub [<<t1>>,<<t2>>]
+  /// CHECK:                        Return
 
   public static int $opt$LiveInCall(int arg) {
     int t1 = arg + 1;
diff --git a/test/run-test b/test/run-test
index 828939d..a5b6e92 100755
--- a/test/run-test
+++ b/test/run-test
@@ -392,7 +392,7 @@
 
 # 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_arch_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
@@ -402,6 +402,14 @@
     fi
 }
 
+function guess_host_arch_name() {
+    if [ "x${suffix64}" = "x64" ]; then
+        host_arch_name="x86_64"
+    else
+        host_arch_name="x86"
+    fi
+}
+
 if [ "$target_mode" = "no" ]; then
     if [ "$runtime" = "jvm" ]; then
         if [ "$prebuild_mode" = "yes" ]; then
@@ -437,10 +445,11 @@
         if [ -z "$ANDROID_HOST_OUT" ]; then
             export ANDROID_HOST_OUT=$ANDROID_BUILD_TOP/out/host/linux-x86
         fi
+        guess_host_arch_name
         run_args="${run_args} --boot ${ANDROID_HOST_OUT}/framework/core${image_suffix}${pic_image_suffix}.art"
         run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}"
     else
-        guess_arch_name
+        guess_target_arch_name
         run_args="${run_args} --runtime-option -Djava.library.path=/data/art-test/${target_arch_name}"
         run_args="${run_args} --boot /data/art-test/core${image_suffix}${pic_image_suffix}.art"
     fi
@@ -635,7 +644,7 @@
       run_checker="yes"
       if [ "$target_mode" = "no" ]; then
         cfg_output_dir="$tmp_dir"
-        checker_arch_option=
+        checker_arch_option="--arch=${host_arch_name^^}"
       else
         cfg_output_dir="$DEX_LOCATION"
         checker_arch_option="--arch=${target_arch_name^^}"