ARM: Faster read barrier marking entrypoints.

Avoid MVN for forwarding address check and another one
undoing the first when we hit a forwarding address.

Test: m test-art-target
Bug: 29516974
Change-Id: I9c0ca70a6fe98f0200df27bf7ed776aee039e64d
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S
index cfe8406..8531091 100644
--- a/runtime/arch/arm/quick_entrypoints_arm.S
+++ b/runtime/arch/arm/quick_entrypoints_arm.S
@@ -2049,9 +2049,13 @@
 
 .Lnot_marked_rb_\name:
     // Test that both the forwarding state bits are 1.
-    mvn ip, ip
-    tst ip, #(LOCK_WORD_STATE_FORWARDING_ADDRESS << LOCK_WORD_STATE_SHIFT)
-    beq .Lret_forwarding_address\name
+#if (LOCK_WORD_STATE_SHIFT != 30) || (LOCK_WORD_STATE_FORWARDING_ADDRESS != 3)
+    // To use "CMP ip, #modified-immediate; BHS", we need the lock word state in
+    // the highest bits and the "forwarding address" state to have all bits set.
+#error "Unexpected lock word state shift or forwarding address state value."
+#endif
+    cmp ip, #(LOCK_WORD_STATE_FORWARDING_ADDRESS << LOCK_WORD_STATE_SHIFT)
+    bhs .Lret_forwarding_address\name
 
 .Lslow_rb_\name:
     // Save IP: The kSaveEverything entrypoint art_quick_resolve_string used to
@@ -2118,7 +2122,6 @@
 .Lret_forwarding_address\name:
     // Shift left by the forwarding address shift. This clears out the state bits since they are
     // in the top 2 bits of the lock word.
-    mvn ip, ip
     lsl \reg, ip, #LOCK_WORD_STATE_FORWARDING_ADDRESS_SHIFT
     bx lr
 END \name