Commit 24a19a43 authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[arm] Fix Float32 constant to Float slot move.

The code generator uses `ip` as a scratch register directly to assemble a
"Constant -> Float stack slot" move. However, the assembler may also use it to
compute the address.

If we try to assemble such a move and the stack slot is out of range of a store
we get the following:
~~~
movw ip, #52429
movt ip, #15820
movw ip, #59328   ; Use ip to compute the address!
movt ip, #65535
str ip, [fp, +ip]
~~~

Bug: 
Change-Id: I97a7b606e3f1d53ed44cc7787e49109cf7a7ab16
Reviewed-on: https://chromium-review.googlesource.com/602230Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#47370}
parent a50b6751
......@@ -2948,8 +2948,9 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
} else if (src.type() == Constant::kFloat32) {
if (destination->IsFloatStackSlot()) {
MemOperand dst = g.ToMemOperand(destination);
__ mov(ip, Operand(bit_cast<int32_t>(src.ToFloat32())));
__ str(ip, dst);
Register temp = kScratchReg;
__ mov(temp, Operand(bit_cast<int32_t>(src.ToFloat32())));
__ str(temp, dst);
} else {
SwVfpRegister dst = g.ToFloatRegister(destination);
__ vmov(dst, Float32(src.ToFloat32AsInt()));
......
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