riscv64: Implement VarHandle.compareAndSet/-Exchange intrinsics.

Test: testrunner.py --target --64 --ndebug --optimizing
Bug: 283082089
Change-Id: I8016cb046d1fbaa5ffe71917a4cce685dfc65f02
diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h
index 7ee076f..20099eb 100644
--- a/compiler/optimizing/locations.h
+++ b/compiler/optimizing/locations.h
@@ -79,7 +79,7 @@
     kUnallocated = 11,
   };
 
-  Location() : ValueObject(), value_(kInvalid) {
+  constexpr Location() : ValueObject(), value_(kInvalid) {
     // Verify that non-constant location kinds do not interfere with kConstant.
     static_assert((kInvalid & kLocationConstantMask) != kConstant, "TagError");
     static_assert((kUnallocated & kLocationConstantMask) != kConstant, "TagError");
@@ -95,7 +95,7 @@
     DCHECK(!IsValid());
   }
 
-  Location(const Location& other) = default;
+  constexpr Location(const Location& other) = default;
 
   Location& operator=(const Location& other) = default;
 
@@ -126,24 +126,24 @@
   }
 
   // Empty location. Used if there the location should be ignored.
-  static Location NoLocation() {
+  static constexpr Location NoLocation() {
     return Location();
   }
 
   // Register locations.
-  static Location RegisterLocation(int reg) {
+  static constexpr Location RegisterLocation(int reg) {
     return Location(kRegister, reg);
   }
 
-  static Location FpuRegisterLocation(int reg) {
+  static constexpr Location FpuRegisterLocation(int reg) {
     return Location(kFpuRegister, reg);
   }
 
-  static Location RegisterPairLocation(int low, int high) {
+  static constexpr Location RegisterPairLocation(int low, int high) {
     return Location(kRegisterPair, low << 16 | high);
   }
 
-  static Location FpuRegisterPairLocation(int low, int high) {
+  static constexpr Location FpuRegisterPairLocation(int low, int high) {
     return Location(kFpuRegisterPair, low << 16 | high);
   }
 
@@ -423,7 +423,7 @@
 
   explicit Location(uintptr_t value) : value_(value) {}
 
-  Location(Kind kind, uintptr_t payload)
+  constexpr Location(Kind kind, uintptr_t payload)
       : value_(KindField::Encode(kind) | PayloadField::Encode(payload)) {}
 
   uintptr_t GetPayload() const {