Fix sign extension issues in x86_64 code generation

movl expects an Immediate int64_t that is in the range -2GB to
2GB.  Cast uint32_t addresses to int32_t before passing as an
Immediate to movl.

In VisitIntegerValueOf, the base address may not fit in the disp32
field.  Fall back to storing the base address in a temporary
register if it is larger than 2GB.

Bug: 36281983
Test: m -j test-art-host with LibartImgHostBaseAddress == 0xa0000000
Change-Id: I5f8cc4f5a6220afc577707e3831113b0ead1d2b2
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 644fcee..5fb27f4 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -5531,7 +5531,7 @@
       uint32_t address = dchecked_integral_cast<uint32_t>(
           reinterpret_cast<uintptr_t>(cls->GetClass().Get()));
       DCHECK_NE(address, 0u);
-      __ movl(out, Immediate(address));  // Zero-extended.
+      __ movl(out, Immediate(static_cast<int32_t>(address)));  // Zero-extended.
       break;
     }
     case HLoadClass::LoadKind::kBssEntry: {
@@ -5666,7 +5666,7 @@
       uint32_t address = dchecked_integral_cast<uint32_t>(
           reinterpret_cast<uintptr_t>(load->GetString().Get()));
       DCHECK_NE(address, 0u);
-      __ movl(out, Immediate(address));  // Zero-extended.
+      __ movl(out, Immediate(static_cast<int32_t>(address)));  // Zero-extended.
       return;  // No dex cache slow path.
     }
     case HLoadString::LoadKind::kBssEntry: {