Revert "[vm] Arm Assembler simplify code for SubImmediateSetFlags"

This reverts commit be38459b98.

Reason for revert: Comments in other pieces of the code state that kMinInt should be able to flow into SubImmediateSetFlags.

Original change's description:
> [vm] Arm Assembler simplify code for SubImmediateSetFlags
> 
> See https://dart-review.googlesource.com/c/sdk/+/124136/9/runtime/vm/compiler/assembler/assembler_arm.cc#3203
> 
> Change-Id: I8d2a1bb781f22d6aae0e02eacf042a203a44790d
> Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-product-arm-try,vm-ffi-android-release-arm-try,vm-kernel-linux-release-simarm-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-bare-linux-release-simarm-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm_x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134333
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,dacoharkes@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Idb6ec6e55256c3a4894179a844d118a41378a074
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, vm-ffi-android-product-arm-try, vm-ffi-android-release-arm-try, vm-kernel-linux-release-simarm-try, vm-kernel-precomp-android-release-arm_x64-try, vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-linux-debug-simarm_x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135645
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
Daco Harkes 2020-02-13 10:25:07 +00:00 committed by commit-bot@chromium.org
parent c096f9d6e5
commit 902e2b097b

View file

@ -3164,7 +3164,6 @@ void Assembler::SubImmediate(Register rd,
Register rn,
int32_t value,
Condition cond) {
ASSERT(value != kMinInt32); // Cannot be negated.
AddImmediate(rd, rn, -value, cond);
}
@ -3172,8 +3171,27 @@ void Assembler::SubImmediateSetFlags(Register rd,
Register rn,
int32_t value,
Condition cond) {
ASSERT(value != kMinInt32); // Cannot be negated.
AddImmediateSetFlags(rd, rn, -value, cond);
Operand o;
if (Operand::CanHold(value, &o)) {
// Handles value == kMinInt32.
subs(rd, rn, o, cond);
} else if (Operand::CanHold(-value, &o)) {
ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
adds(rd, rn, o, cond);
} else {
ASSERT(rn != IP);
if (Operand::CanHold(~value, &o)) {
mvn(IP, o, cond);
subs(rd, rn, Operand(IP), cond);
} else if (Operand::CanHold(~(-value), &o)) {
ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
mvn(IP, o, cond);
adds(rd, rn, Operand(IP), cond);
} else {
LoadDecodableImmediate(IP, value, cond);
subs(rd, rn, Operand(IP), cond);
}
}
}
void Assembler::AndImmediate(Register rd,