Fix sub codegen bug
Ancient codegen bug, very uncommon case.
Change-Id: I1f7c277f8a61ba21bf987f9d8b4d206f7f03d4e0
diff --git a/src/compiler/codegen/arm/Thumb2/Factory.cc b/src/compiler/codegen/arm/Thumb2/Factory.cc
index b3f3a41..78b9e61 100644
--- a/src/compiler/codegen/arm/Thumb2/Factory.cc
+++ b/src/compiler/codegen/arm/Thumb2/Factory.cc
@@ -473,8 +473,6 @@
return newLIR3(cUnit, kThumbAddPcRel, rDest, rSrc1,
value >> 2);
}
- opcode = kThumb2AddRRI8;
- altOpcode = kThumb2AddRRR;
// Note: intentional fallthrough
case kOpSub:
if (allLowRegs && ((absValue & 0x7) == absValue)) {
@@ -497,6 +495,9 @@
if (op == kOpSub) {
opcode = kThumb2SubRRI8;
altOpcode = kThumb2SubRRR;
+ } else {
+ opcode = kThumb2AddRRI8;
+ altOpcode = kThumb2AddRRR;
}
break;
case kOpAdc: