Support float & double negation in the optimizing compiler.

- Add support for the neg-float and neg-double Dex
  instructions in the optimizing compiler.
- Generate x86, x86-64 and ARM (but not ARM64) code for
  float and double HNeg nodes.
- Add related tests to test/415-optimizing-arith-neg.

Change-Id: I29739a86e13dbe6f64e191641d01637c867cba6c
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index b2d9187..42e6072 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -1116,7 +1116,10 @@
 
     case Primitive::kPrimFloat:
     case Primitive::kPrimDouble:
-      LOG(FATAL) << "Not yet implemented neg type " << neg->GetResultType();
+      locations->SetInAt(0, Location::RequiresFpuRegister());
+      // Output overlaps as we need a fresh (zero-initialized)
+      // register to perform subtraction from zero.
+      locations->SetOut(Location::RequiresFpuRegister());
       break;
 
     default:
@@ -1131,11 +1134,13 @@
   switch (neg->GetResultType()) {
     case Primitive::kPrimInt:
       DCHECK(in.IsRegister());
+      DCHECK(in.Equals(out));
       __ negl(out.As<Register>());
       break;
 
     case Primitive::kPrimLong:
       DCHECK(in.IsRegisterPair());
+      DCHECK(in.Equals(out));
       __ negl(out.AsRegisterPairLow<Register>());
       // Negation is similar to subtraction from zero.  The least
       // significant byte triggers a borrow when it is different from
@@ -1147,8 +1152,19 @@
       break;
 
     case Primitive::kPrimFloat:
+      DCHECK(!in.Equals(out));
+      // out = 0
+      __ xorps(out.As<XmmRegister>(), out.As<XmmRegister>());
+      // out = out - in
+      __ subss(out.As<XmmRegister>(), in.As<XmmRegister>());
+      break;
+
     case Primitive::kPrimDouble:
-      LOG(FATAL) << "Not yet implemented neg type " << neg->GetResultType();
+      DCHECK(!in.Equals(out));
+      // out = 0
+      __ xorpd(out.As<XmmRegister>(), out.As<XmmRegister>());
+      // out = out - in
+      __ subsd(out.As<XmmRegister>(), in.As<XmmRegister>());
       break;
 
     default: