Skip to content

Commit 53807c1

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[vm] Remove ARMv6 related code
This also allows unaligned access, since it's mandatory for ARMv7 (we already take advantage of it for ARMv8). Issue #42069 Change-Id: I0bd61a930e61dea330ab21fd187fe64b057ca28e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152322 Reviewed-by: Siva Annamalai <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent 85d37c1 commit 53807c1

14 files changed

+48
-407
lines changed

runtime/BUILD.gn

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ config("dart_arch_config") {
101101

102102
if (dart_target_arch == "arm") {
103103
defines += [ "TARGET_ARCH_ARM" ]
104-
} else if (dart_target_arch == "armv6") {
105-
defines += [ "TARGET_ARCH_ARM" ]
106-
defines += [ "TARGET_ARCH_ARM_6" ]
107104
} else if (dart_target_arch == "arm64") {
108105
defines += [ "TARGET_ARCH_ARM64" ]
109106
} else if (dart_target_arch == "x64") {

runtime/tests/vm/vm.status

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ cc/GenKernelKernelReadAllBytecode: SkipByDesign # No interpreter support.
357357
# On the simluator stack traces produced by the Profiler do not match
358358
# up with the real Dart stack trace and hence we don't get correct
359359
# symbol names.
360-
[ $arch == simarm || $arch == simarm64 || $arch == simarmv6 ]
360+
[ $arch == simarm || $arch == simarm64 ]
361361
cc/LargeMap: SkipByDesign
362362
cc/Profiler_AllocationSampleTest: SkipByDesign
363363
cc/Profiler_ArrayAllocation: SkipByDesign

runtime/vm/compiler/assembler/assembler_arm.cc

Lines changed: 12 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,8 @@ void Assembler::mls(Register rd,
364364
Register ra,
365365
Condition cond) {
366366
// rd <- ra - rn * rm.
367-
if (TargetCPUFeatures::arm_version() == ARMv7) {
368-
// Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd.
369-
EmitMulOp(cond, B22 | B21, ra, rd, rn, rm);
370-
} else {
371-
mul(IP, rn, rm, cond);
372-
sub(rd, ra, Operand(IP), cond);
373-
}
367+
// Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd.
368+
EmitMulOp(cond, B22 | B21, ra, rd, rn, rm);
374369
}
375370

376371
void Assembler::smull(Register rd_lo,
@@ -978,9 +973,6 @@ void Assembler::vmovd(DRegister dd, DRegister dm, Condition cond) {
978973
}
979974

980975
bool Assembler::vmovs(SRegister sd, float s_imm, Condition cond) {
981-
if (TargetCPUFeatures::arm_version() != ARMv7) {
982-
return false;
983-
}
984976
uint32_t imm32 = bit_cast<uint32_t, float>(s_imm);
985977
if (((imm32 & ((1 << 19) - 1)) == 0) &&
986978
((((imm32 >> 25) & ((1 << 6) - 1)) == (1 << 5)) ||
@@ -995,9 +987,6 @@ bool Assembler::vmovs(SRegister sd, float s_imm, Condition cond) {
995987
}
996988

997989
bool Assembler::vmovd(DRegister dd, double d_imm, Condition cond) {
998-
if (TargetCPUFeatures::arm_version() != ARMv7) {
999-
return false;
1000-
}
1001990
uint64_t imm64 = bit_cast<uint64_t, double>(d_imm);
1002991
if (((imm64 & ((1LL << 48) - 1)) == 0) &&
1003992
((((imm64 >> 54) & ((1 << 9) - 1)) == (1 << 8)) ||
@@ -2074,69 +2063,15 @@ static int32_t DecodeARMv7LoadImmediate(int32_t movt, int32_t movw) {
20742063
return offset;
20752064
}
20762065

2077-
static int32_t DecodeARMv6LoadImmediate(int32_t mov,
2078-
int32_t or1,
2079-
int32_t or2,
2080-
int32_t or3) {
2081-
int32_t offset = 0;
2082-
offset |= (mov & 0xff) << 24;
2083-
offset |= (or1 & 0xff) << 16;
2084-
offset |= (or2 & 0xff) << 8;
2085-
offset |= (or3 & 0xff);
2086-
return offset;
2087-
}
2088-
20892066
class PatchFarBranch : public AssemblerFixup {
20902067
public:
20912068
PatchFarBranch() {}
20922069

20932070
void Process(const MemoryRegion& region, intptr_t position) {
2094-
const ARMVersion version = TargetCPUFeatures::arm_version();
2095-
if (version == ARMv6) {
2096-
ProcessARMv6(region, position);
2097-
} else {
2098-
ASSERT(version == ARMv7);
2099-
ProcessARMv7(region, position);
2100-
}
2071+
ProcessARMv7(region, position);
21012072
}
21022073

21032074
private:
2104-
void ProcessARMv6(const MemoryRegion& region, intptr_t position) {
2105-
const int32_t mov = region.Load<int32_t>(position);
2106-
const int32_t or1 = region.Load<int32_t>(position + 1 * Instr::kInstrSize);
2107-
const int32_t or2 = region.Load<int32_t>(position + 2 * Instr::kInstrSize);
2108-
const int32_t or3 = region.Load<int32_t>(position + 3 * Instr::kInstrSize);
2109-
const int32_t bx = region.Load<int32_t>(position + 4 * Instr::kInstrSize);
2110-
2111-
if (((mov & 0xffffff00) == 0xe3a0c400) && // mov IP, (byte3 rot 4)
2112-
((or1 & 0xffffff00) == 0xe38cc800) && // orr IP, IP, (byte2 rot 8)
2113-
((or2 & 0xffffff00) == 0xe38ccc00) && // orr IP, IP, (byte1 rot 12)
2114-
((or3 & 0xffffff00) == 0xe38cc000)) { // orr IP, IP, byte0
2115-
const int32_t offset = DecodeARMv6LoadImmediate(mov, or1, or2, or3);
2116-
const int32_t dest = region.start() + offset;
2117-
const int32_t dest0 = (dest & 0x000000ff);
2118-
const int32_t dest1 = (dest & 0x0000ff00) >> 8;
2119-
const int32_t dest2 = (dest & 0x00ff0000) >> 16;
2120-
const int32_t dest3 = (dest & 0xff000000) >> 24;
2121-
const int32_t patched_mov = 0xe3a0c400 | dest3;
2122-
const int32_t patched_or1 = 0xe38cc800 | dest2;
2123-
const int32_t patched_or2 = 0xe38ccc00 | dest1;
2124-
const int32_t patched_or3 = 0xe38cc000 | dest0;
2125-
2126-
region.Store<int32_t>(position + 0 * Instr::kInstrSize, patched_mov);
2127-
region.Store<int32_t>(position + 1 * Instr::kInstrSize, patched_or1);
2128-
region.Store<int32_t>(position + 2 * Instr::kInstrSize, patched_or2);
2129-
region.Store<int32_t>(position + 3 * Instr::kInstrSize, patched_or3);
2130-
return;
2131-
}
2132-
2133-
// If the offset loading instructions aren't there, we must have replaced
2134-
// the far branch with a near one, and so these instructions
2135-
// should be NOPs.
2136-
ASSERT((or1 == Instr::kNopInstruction) && (or2 == Instr::kNopInstruction) &&
2137-
(or3 == Instr::kNopInstruction) && (bx == Instr::kNopInstruction));
2138-
}
2139-
21402075
void ProcessARMv7(const MemoryRegion& region, intptr_t position) {
21412076
const int32_t movw = region.Load<int32_t>(position);
21422077
const int32_t movt = region.Load<int32_t>(position + Instr::kInstrSize);
@@ -2198,85 +2133,6 @@ void Assembler::EmitBranch(Condition cond, Label* label, bool link) {
21982133
}
21992134
}
22002135

2201-
void Assembler::BindARMv6(Label* label) {
2202-
ASSERT(!label->IsBound());
2203-
intptr_t bound_pc = buffer_.Size();
2204-
while (label->IsLinked()) {
2205-
const int32_t position = label->Position();
2206-
int32_t dest = bound_pc - position;
2207-
if (use_far_branches() && !CanEncodeBranchDistance(dest)) {
2208-
// Far branches are enabled and we can't encode the branch offset.
2209-
2210-
// Grab instructions that load the offset.
2211-
const int32_t mov = buffer_.Load<int32_t>(position);
2212-
const int32_t or1 =
2213-
buffer_.Load<int32_t>(position + 1 * Instr::kInstrSize);
2214-
const int32_t or2 =
2215-
buffer_.Load<int32_t>(position + 2 * Instr::kInstrSize);
2216-
const int32_t or3 =
2217-
buffer_.Load<int32_t>(position + 3 * Instr::kInstrSize);
2218-
2219-
// Change from relative to the branch to relative to the assembler
2220-
// buffer.
2221-
dest = buffer_.Size();
2222-
const int32_t dest0 = (dest & 0x000000ff);
2223-
const int32_t dest1 = (dest & 0x0000ff00) >> 8;
2224-
const int32_t dest2 = (dest & 0x00ff0000) >> 16;
2225-
const int32_t dest3 = (dest & 0xff000000) >> 24;
2226-
const int32_t patched_mov = 0xe3a0c400 | dest3;
2227-
const int32_t patched_or1 = 0xe38cc800 | dest2;
2228-
const int32_t patched_or2 = 0xe38ccc00 | dest1;
2229-
const int32_t patched_or3 = 0xe38cc000 | dest0;
2230-
2231-
// Rewrite the instructions.
2232-
buffer_.Store<int32_t>(position + 0 * Instr::kInstrSize, patched_mov);
2233-
buffer_.Store<int32_t>(position + 1 * Instr::kInstrSize, patched_or1);
2234-
buffer_.Store<int32_t>(position + 2 * Instr::kInstrSize, patched_or2);
2235-
buffer_.Store<int32_t>(position + 3 * Instr::kInstrSize, patched_or3);
2236-
label->position_ = DecodeARMv6LoadImmediate(mov, or1, or2, or3);
2237-
} else if (use_far_branches() && CanEncodeBranchDistance(dest)) {
2238-
// Grab instructions that load the offset, and the branch.
2239-
const int32_t mov = buffer_.Load<int32_t>(position);
2240-
const int32_t or1 =
2241-
buffer_.Load<int32_t>(position + 1 * Instr::kInstrSize);
2242-
const int32_t or2 =
2243-
buffer_.Load<int32_t>(position + 2 * Instr::kInstrSize);
2244-
const int32_t or3 =
2245-
buffer_.Load<int32_t>(position + 3 * Instr::kInstrSize);
2246-
const int32_t branch =
2247-
buffer_.Load<int32_t>(position + 4 * Instr::kInstrSize);
2248-
2249-
// Grab the branch condition, and encode the link bit.
2250-
const int32_t cond = branch & 0xf0000000;
2251-
const int32_t link = (branch & 0x20) << 19;
2252-
2253-
// Encode the branch and the offset.
2254-
const int32_t new_branch = cond | link | 0x0a000000;
2255-
const int32_t encoded = EncodeBranchOffset(dest, new_branch);
2256-
2257-
// Write the encoded branch instruction followed by two nops.
2258-
buffer_.Store<int32_t>(position, encoded);
2259-
buffer_.Store<int32_t>(position + 1 * Instr::kInstrSize,
2260-
Instr::kNopInstruction);
2261-
buffer_.Store<int32_t>(position + 2 * Instr::kInstrSize,
2262-
Instr::kNopInstruction);
2263-
buffer_.Store<int32_t>(position + 3 * Instr::kInstrSize,
2264-
Instr::kNopInstruction);
2265-
buffer_.Store<int32_t>(position + 4 * Instr::kInstrSize,
2266-
Instr::kNopInstruction);
2267-
2268-
label->position_ = DecodeARMv6LoadImmediate(mov, or1, or2, or3);
2269-
} else {
2270-
BailoutIfInvalidBranchOffset(dest);
2271-
int32_t next = buffer_.Load<int32_t>(position);
2272-
int32_t encoded = Assembler::EncodeBranchOffset(dest, next);
2273-
buffer_.Store<int32_t>(position, encoded);
2274-
label->position_ = Assembler::DecodeBranchOffset(next);
2275-
}
2276-
}
2277-
label->BindTo(bound_pc);
2278-
}
2279-
22802136
void Assembler::BindARMv7(Label* label) {
22812137
ASSERT(!label->IsBound());
22822138
intptr_t bound_pc = buffer_.Size();
@@ -2345,13 +2201,7 @@ void Assembler::BindARMv7(Label* label) {
23452201
}
23462202

23472203
void Assembler::Bind(Label* label) {
2348-
const ARMVersion version = TargetCPUFeatures::arm_version();
2349-
if (version == ARMv6) {
2350-
BindARMv6(label);
2351-
} else {
2352-
ASSERT(version == ARMv7);
2353-
BindARMv7(label);
2354-
}
2204+
BindARMv7(label);
23552205
}
23562206

23572207
OperandSize Address::OperandSizeFor(intptr_t cid) {
@@ -2794,45 +2644,19 @@ void Assembler::BranchLinkOffset(Register base, int32_t offset) {
27942644
void Assembler::LoadPatchableImmediate(Register rd,
27952645
int32_t value,
27962646
Condition cond) {
2797-
const ARMVersion version = TargetCPUFeatures::arm_version();
2798-
if (version == ARMv6) {
2799-
// This sequence is patched in a few places, and should remain fixed.
2800-
const uint32_t byte0 = (value & 0x000000ff);
2801-
const uint32_t byte1 = (value & 0x0000ff00) >> 8;
2802-
const uint32_t byte2 = (value & 0x00ff0000) >> 16;
2803-
const uint32_t byte3 = (value & 0xff000000) >> 24;
2804-
mov(rd, Operand(4, byte3), cond);
2805-
orr(rd, rd, Operand(8, byte2), cond);
2806-
orr(rd, rd, Operand(12, byte1), cond);
2807-
orr(rd, rd, Operand(byte0), cond);
2808-
} else {
2809-
ASSERT(version == ARMv7);
2810-
const uint16_t value_low = Utils::Low16Bits(value);
2811-
const uint16_t value_high = Utils::High16Bits(value);
2812-
movw(rd, value_low, cond);
2813-
movt(rd, value_high, cond);
2814-
}
2647+
const uint16_t value_low = Utils::Low16Bits(value);
2648+
const uint16_t value_high = Utils::High16Bits(value);
2649+
movw(rd, value_low, cond);
2650+
movt(rd, value_high, cond);
28152651
}
28162652

28172653
void Assembler::LoadDecodableImmediate(Register rd,
28182654
int32_t value,
28192655
Condition cond) {
2820-
const ARMVersion version = TargetCPUFeatures::arm_version();
2821-
if (version == ARMv6) {
2822-
if (constant_pool_allowed()) {
2823-
const int32_t offset =
2824-
target::ObjectPool::element_offset(FindImmediate(value));
2825-
LoadWordFromPoolOffset(rd, offset - kHeapObjectTag, PP, cond);
2826-
} else {
2827-
LoadPatchableImmediate(rd, value, cond);
2828-
}
2829-
} else {
2830-
ASSERT(version == ARMv7);
2831-
movw(rd, Utils::Low16Bits(value), cond);
2832-
const uint16_t value_high = Utils::High16Bits(value);
2833-
if (value_high != 0) {
2834-
movt(rd, value_high, cond);
2835-
}
2656+
movw(rd, Utils::Low16Bits(value), cond);
2657+
const uint16_t value_high = Utils::High16Bits(value);
2658+
if (value_high != 0) {
2659+
movt(rd, value_high, cond);
28362660
}
28372661
}
28382662

runtime/vm/compiler/assembler/assembler_arm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,6 @@ class Assembler : public AssemblerBase {
12831283
void movw(Register rd, uint16_t imm16, Condition cond = AL);
12841284
void movt(Register rd, uint16_t imm16, Condition cond = AL);
12851285

1286-
void BindARMv6(Label* label);
12871286
void BindARMv7(Label* label);
12881287

12891288
void BranchLink(const ExternalLabel* label);

runtime/vm/compiler/assembler/assembler_arm_test.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,8 @@ ASSEMBLER_TEST_RUN(MoveRotImm, test) {
101101
}
102102

103103
ASSEMBLER_TEST_GENERATE(MovImm16, assembler) {
104-
#if defined(USING_SIMULATOR)
105-
// ARMv7 is the default.
106-
HostCPUFeatures::set_arm_version(ARMv6);
107-
__ LoadPatchableImmediate(R0, 0x12345678 << 1);
108-
HostCPUFeatures::set_arm_version(ARMv7);
109-
__ LoadPatchableImmediate(R1, 0x12345678);
110-
__ sub(R0, R0, Operand(R1));
111-
__ bx(LR);
112-
#else
113104
__ LoadPatchableImmediate(R0, 0x12345678);
114105
__ bx(LR);
115-
#endif
116106
}
117107

118108
ASSEMBLER_TEST_RUN(MovImm16, test) {

runtime/vm/compiler/assembler/disassembler_arm.cc

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,6 @@ void ARMDecoder::DecodeType01(Instr* instr) {
693693
break;
694694
}
695695
case 3: {
696-
if (TargetCPUFeatures::arm_version() != ARMv7) {
697-
Unknown(instr);
698-
return;
699-
}
700696
// Assembler registers rd, rn, rm, ra are encoded as rn, rm, rs, rd.
701697
Format(instr, "mls'cond's 'rn, 'rm, 'rs, 'rd");
702698
break;
@@ -742,11 +738,7 @@ void ARMDecoder::DecodeType01(Instr* instr) {
742738
// 16-bit immediate loads, msr (immediate), and hints
743739
switch (instr->Bits(20, 5)) {
744740
case 16: {
745-
if (TargetCPUFeatures::arm_version() == ARMv7) {
746-
Format(instr, "movw'cond 'rd, #'imm4_12");
747-
} else {
748-
Unknown(instr);
749-
}
741+
Format(instr, "movw'cond 'rd, #'imm4_12");
750742
break;
751743
}
752744
case 18: {
@@ -758,11 +750,7 @@ void ARMDecoder::DecodeType01(Instr* instr) {
758750
break;
759751
}
760752
case 20: {
761-
if (TargetCPUFeatures::arm_version() == ARMv7) {
762-
Format(instr, "movt'cond 'rd, #'imm4_12");
763-
} else {
764-
Unknown(instr);
765-
}
753+
Format(instr, "movt'cond 'rd, #'imm4_12");
766754
break;
767755
}
768756
default: {

runtime/vm/compiler/backend/il_arm.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2677,7 +2677,7 @@ LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone,
26772677
bool opt) const {
26782678
const bool might_box = (representation() == kTagged) && !can_pack_into_smi();
26792679
const intptr_t kNumInputs = 2;
2680-
const intptr_t kNumTemps = might_box ? 1 : 0;
2680+
const intptr_t kNumTemps = might_box ? 2 : 0;
26812681
LocationSummary* summary = new (zone) LocationSummary(
26822682
zone, kNumInputs, kNumTemps,
26832683
might_box ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall);
@@ -2686,6 +2686,7 @@ LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone,
26862686

26872687
if (might_box) {
26882688
summary->set_temp(0, Location::RequiresRegister());
2689+
summary->set_temp(1, Location::RequiresRegister());
26892690
}
26902691

26912692
if (representation() == kUnboxedInt64) {

runtime/vm/compiler/ffi/native_calling_convention.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ class ArgumentAllocator : public ValueObject {
209209
// > Procedure Call Standard is used. In this variant, floating-point
210210
// > (and vector) arguments are passed in general purpose registers
211211
// > (GPRs) instead of in VFP registers)
212-
// https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009021-SW1
213212
// https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv7FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009022-SW1
214213
void BlockAllFpuRegisters() {
215214
// Set all bits to 1.

0 commit comments

Comments
 (0)