Add support for int-to-float & int-to-double in optimizing.

- Add support for the int-to-float and int-to-double Dex
  instructions in the optimizing compiler.
- Generate x86, x86-64 and ARM (but not ARM64) code for
  byte to float, short to float, int to float, char to
  float, byte to double, short to double, int to double and
  char to double HTypeConversion nodes.
- Add related tests to test/422-type-conversion.

Change-Id: I963f9d0184a5d3721af2d8f593f133d5af7aa6a3
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 47fb74f..29479a2 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -1393,9 +1393,49 @@
       break;
 
     case Primitive::kPrimFloat:
+      switch (input_type) {
+        case Primitive::kPrimByte:
+        case Primitive::kPrimShort:
+        case Primitive::kPrimInt:
+        case Primitive::kPrimChar:
+          // Processing a Dex `int-to-float' instruction.
+          locations->SetInAt(0, Location::RequiresRegister());
+          locations->SetOut(Location::RequiresFpuRegister());
+          break;
+
+        case Primitive::kPrimLong:
+        case Primitive::kPrimDouble:
+          LOG(FATAL) << "Type conversion from " << input_type
+                     << " to " << result_type << " not yet implemented";
+          break;
+
+        default:
+          LOG(FATAL) << "Unexpected type conversion from " << input_type
+                     << " to " << result_type;
+      };
+      break;
+
     case Primitive::kPrimDouble:
-      LOG(FATAL) << "Type conversion from " << input_type
-                 << " to " << result_type << " not yet implemented";
+      switch (input_type) {
+        case Primitive::kPrimByte:
+        case Primitive::kPrimShort:
+        case Primitive::kPrimInt:
+        case Primitive::kPrimChar:
+          // Processing a Dex `int-to-double' instruction.
+          locations->SetInAt(0, Location::RequiresRegister());
+          locations->SetOut(Location::RequiresFpuRegister());
+          break;
+
+        case Primitive::kPrimLong:
+        case Primitive::kPrimFloat:
+          LOG(FATAL) << "Type conversion from " << input_type
+                     << " to " << result_type << " not yet implemented";
+          break;
+
+        default:
+          LOG(FATAL) << "Unexpected type conversion from " << input_type
+                     << " to " << result_type;
+      }
       break;
 
     default:
@@ -1538,9 +1578,47 @@
       break;
 
     case Primitive::kPrimFloat:
+      switch (input_type) {
+          // Processing a Dex `int-to-float' instruction.
+        case Primitive::kPrimByte:
+        case Primitive::kPrimShort:
+        case Primitive::kPrimInt:
+        case Primitive::kPrimChar:
+          __ cvtsi2ss(out.As<XmmRegister>(), in.As<CpuRegister>());
+          break;
+
+        case Primitive::kPrimLong:
+        case Primitive::kPrimDouble:
+          LOG(FATAL) << "Type conversion from " << input_type
+                     << " to " << result_type << " not yet implemented";
+          break;
+
+        default:
+          LOG(FATAL) << "Unexpected type conversion from " << input_type
+                     << " to " << result_type;
+      };
+      break;
+
     case Primitive::kPrimDouble:
-      LOG(FATAL) << "Type conversion from " << input_type
-                 << " to " << result_type << " not yet implemented";
+      switch (input_type) {
+          // Processing a Dex `int-to-double' instruction.
+        case Primitive::kPrimByte:
+        case Primitive::kPrimShort:
+        case Primitive::kPrimInt:
+        case Primitive::kPrimChar:
+          __ cvtsi2sd(out.As<XmmRegister>(), in.As<CpuRegister>());
+          break;
+
+        case Primitive::kPrimLong:
+        case Primitive::kPrimFloat:
+          LOG(FATAL) << "Type conversion from " << input_type
+                     << " to " << result_type << " not yet implemented";
+          break;
+
+        default:
+          LOG(FATAL) << "Unexpected type conversion from " << input_type
+                     << " to " << result_type;
+      };
       break;
 
     default: