Commit 89a7c4a0 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan,arm] Add float loads poisoning.

Bug: chromium:798964
Change-Id: I1ef202296744a39054366f2bc424d6952c3bbe9d
Reviewed-on: https://chromium-review.googlesource.com/955588Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51836}
parent 5025e415
...@@ -324,7 +324,7 @@ Condition FlagsConditionToCondition(FlagsCondition condition) { ...@@ -324,7 +324,7 @@ Condition FlagsConditionToCondition(FlagsCondition condition) {
} }
void EmitWordLoadPoisoningIfNeeded(CodeGenerator* codegen, void EmitWordLoadPoisoningIfNeeded(CodeGenerator* codegen,
InstructionCode opcode, Instruction* instr, InstructionCode opcode,
ArmOperandConverter& i) { ArmOperandConverter& i) {
const MemoryAccessMode access_mode = const MemoryAccessMode access_mode =
static_cast<MemoryAccessMode>(MiscField::decode(opcode)); static_cast<MemoryAccessMode>(MiscField::decode(opcode));
...@@ -334,6 +334,25 @@ void EmitWordLoadPoisoningIfNeeded(CodeGenerator* codegen, ...@@ -334,6 +334,25 @@ void EmitWordLoadPoisoningIfNeeded(CodeGenerator* codegen,
} }
} }
void ComputePoisonedAddressForLoad(CodeGenerator* codegen,
InstructionCode opcode,
ArmOperandConverter& i, Register address) {
DCHECK_EQ(kMemoryAccessPoisoned,
static_cast<MemoryAccessMode>(MiscField::decode(opcode)));
switch (AddressingModeField::decode(opcode)) {
case kMode_Offset_RI:
codegen->tasm()->mov(address, i.InputImmediate(1));
codegen->tasm()->add(address, address, i.InputRegister(0));
break;
case kMode_Offset_RR:
codegen->tasm()->add(address, i.InputRegister(0), i.InputRegister(1));
break;
default:
UNREACHABLE();
}
codegen->tasm()->and_(address, address, Operand(kSpeculationPoisonRegister));
}
} // namespace } // namespace
#define ASSEMBLE_ATOMIC_LOAD_INTEGER(asm_instr) \ #define ASSEMBLE_ATOMIC_LOAD_INTEGER(asm_instr) \
...@@ -1514,12 +1533,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1514,12 +1533,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kArmLdrb: case kArmLdrb:
__ ldrb(i.OutputRegister(), i.InputOffset()); __ ldrb(i.OutputRegister(), i.InputOffset());
DCHECK_EQ(LeaveCC, i.OutputSBit()); DCHECK_EQ(LeaveCC, i.OutputSBit());
EmitWordLoadPoisoningIfNeeded(this, opcode, instr, i); EmitWordLoadPoisoningIfNeeded(this, opcode, i);
break; break;
case kArmLdrsb: case kArmLdrsb:
__ ldrsb(i.OutputRegister(), i.InputOffset()); __ ldrsb(i.OutputRegister(), i.InputOffset());
DCHECK_EQ(LeaveCC, i.OutputSBit()); DCHECK_EQ(LeaveCC, i.OutputSBit());
EmitWordLoadPoisoningIfNeeded(this, opcode, instr, i); EmitWordLoadPoisoningIfNeeded(this, opcode, i);
break; break;
case kArmStrb: case kArmStrb:
__ strb(i.InputRegister(0), i.InputOffset(1)); __ strb(i.InputRegister(0), i.InputOffset(1));
...@@ -1527,11 +1546,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1527,11 +1546,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break; break;
case kArmLdrh: case kArmLdrh:
__ ldrh(i.OutputRegister(), i.InputOffset()); __ ldrh(i.OutputRegister(), i.InputOffset());
EmitWordLoadPoisoningIfNeeded(this, opcode, instr, i); EmitWordLoadPoisoningIfNeeded(this, opcode, i);
break; break;
case kArmLdrsh: case kArmLdrsh:
__ ldrsh(i.OutputRegister(), i.InputOffset()); __ ldrsh(i.OutputRegister(), i.InputOffset());
EmitWordLoadPoisoningIfNeeded(this, opcode, instr, i); EmitWordLoadPoisoningIfNeeded(this, opcode, i);
break; break;
case kArmStrh: case kArmStrh:
__ strh(i.InputRegister(0), i.InputOffset(1)); __ strh(i.InputRegister(0), i.InputOffset(1));
...@@ -1539,14 +1558,23 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1539,14 +1558,23 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break; break;
case kArmLdr: case kArmLdr:
__ ldr(i.OutputRegister(), i.InputOffset()); __ ldr(i.OutputRegister(), i.InputOffset());
EmitWordLoadPoisoningIfNeeded(this, opcode, instr, i); EmitWordLoadPoisoningIfNeeded(this, opcode, i);
break; break;
case kArmStr: case kArmStr:
__ str(i.InputRegister(0), i.InputOffset(1)); __ str(i.InputRegister(0), i.InputOffset(1));
DCHECK_EQ(LeaveCC, i.OutputSBit()); DCHECK_EQ(LeaveCC, i.OutputSBit());
break; break;
case kArmVldrF32: { case kArmVldrF32: {
__ vldr(i.OutputFloatRegister(), i.InputOffset()); const MemoryAccessMode access_mode =
static_cast<MemoryAccessMode>(MiscField::decode(opcode));
if (access_mode == kMemoryAccessPoisoned) {
UseScratchRegisterScope temps(tasm());
Register address = temps.Acquire();
ComputePoisonedAddressForLoad(this, opcode, i, address);
__ vldr(i.OutputFloatRegister(), address, 0);
} else {
__ vldr(i.OutputFloatRegister(), i.InputOffset());
}
DCHECK_EQ(LeaveCC, i.OutputSBit()); DCHECK_EQ(LeaveCC, i.OutputSBit());
break; break;
} }
...@@ -1574,10 +1602,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1574,10 +1602,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
i.NeonInputOperand(1)); i.NeonInputOperand(1));
break; break;
} }
case kArmVldrF64: case kArmVldrF64: {
__ vldr(i.OutputDoubleRegister(), i.InputOffset()); const MemoryAccessMode access_mode =
static_cast<MemoryAccessMode>(MiscField::decode(opcode));
if (access_mode == kMemoryAccessPoisoned) {
UseScratchRegisterScope temps(tasm());
Register address = temps.Acquire();
ComputePoisonedAddressForLoad(this, opcode, i, address);
__ vldr(i.OutputDoubleRegister(), address, 0);
} else {
__ vldr(i.OutputDoubleRegister(), i.InputOffset());
}
DCHECK_EQ(LeaveCC, i.OutputSBit()); DCHECK_EQ(LeaveCC, i.OutputSBit());
break; break;
}
case kArmVstrF64: case kArmVstrF64:
__ vstr(i.InputDoubleRegister(0), i.InputOffset(1)); __ vstr(i.InputDoubleRegister(0), i.InputOffset(1));
DCHECK_EQ(LeaveCC, i.OutputSBit()); DCHECK_EQ(LeaveCC, i.OutputSBit());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment