forked from mirrors/gecko-dev
Bug 1940716 - convertDoubleToInt32: Clobber destination register when zero. a=dmeehan
Original Revision: https://phabricator.services.mozilla.com/D234893 Differential Revision: https://phabricator.services.mozilla.com/D236700
This commit is contained in:
parent
9ca513777a
commit
c3b0d15ca3
2 changed files with 26 additions and 9 deletions
|
|
@ -139,13 +139,17 @@ void MacroAssemblerARM::convertDoubleToInt32(FloatRegister src, Register dest,
|
||||||
ma_b(fail, Assembler::VFP_NotEqualOrUnordered);
|
ma_b(fail, Assembler::VFP_NotEqualOrUnordered);
|
||||||
|
|
||||||
if (negativeZeroCheck) {
|
if (negativeZeroCheck) {
|
||||||
|
Label nonzero;
|
||||||
as_cmp(dest, Imm8(0));
|
as_cmp(dest, Imm8(0));
|
||||||
|
ma_b(&nonzero, Assembler::NotEqual);
|
||||||
// Test and bail for -0.0, when integer result is 0. Move the top word
|
// Test and bail for -0.0, when integer result is 0. Move the top word
|
||||||
// of the double into the output reg, if it is non-zero, then the
|
// of the double into the output reg, if it is non-zero, then the
|
||||||
// original value was -0.0.
|
// original value was -0.0.
|
||||||
as_vxfer(dest, InvalidReg, src, FloatToCore, Assembler::Equal, 1);
|
as_vxfer(dest, InvalidReg, src, FloatToCore, Assembler::Always, 1);
|
||||||
ma_cmp(dest, Imm32(0x80000000), scratch, Assembler::Equal);
|
as_cmp(dest, Imm8(0));
|
||||||
ma_b(fail, Assembler::Equal);
|
ma_b(fail, Assembler::LessThan);
|
||||||
|
ma_mov(Imm32(0), dest);
|
||||||
|
bind(&nonzero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,14 +184,18 @@ void MacroAssemblerARM::convertFloat32ToInt32(FloatRegister src, Register dest,
|
||||||
ma_b(fail, Assembler::Equal);
|
ma_b(fail, Assembler::Equal);
|
||||||
|
|
||||||
if (negativeZeroCheck) {
|
if (negativeZeroCheck) {
|
||||||
|
Label nonzero;
|
||||||
as_cmp(dest, Imm8(0));
|
as_cmp(dest, Imm8(0));
|
||||||
|
ma_b(&nonzero, Assembler::NotEqual);
|
||||||
// Test and bail for -0.0, when integer result is 0. Move the float into
|
// Test and bail for -0.0, when integer result is 0. Move the float into
|
||||||
// the output reg, and if it is non-zero then the original value was
|
// the output reg, and if it is non-zero then the original value was
|
||||||
// -0.0
|
// -0.0
|
||||||
as_vxfer(dest, InvalidReg, VFPRegister(src).singleOverlay(), FloatToCore,
|
as_vxfer(dest, InvalidReg, VFPRegister(src).singleOverlay(), FloatToCore,
|
||||||
Assembler::Equal, 0);
|
Assembler::Always, 0);
|
||||||
ma_cmp(dest, Imm32(0x80000000), scratch, Assembler::Equal);
|
as_cmp(dest, Imm8(0));
|
||||||
ma_b(fail, Assembler::Equal);
|
ma_b(fail, Assembler::LessThan);
|
||||||
|
ma_mov(Imm32(0), dest);
|
||||||
|
bind(&nonzero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -626,8 +626,11 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
|
||||||
if (negativeZeroCheck) {
|
if (negativeZeroCheck) {
|
||||||
Label nonzero;
|
Label nonzero;
|
||||||
Cbnz(dest32, &nonzero);
|
Cbnz(dest32, &nonzero);
|
||||||
|
// dest32 is 0, fail if fsrc64 is negative.
|
||||||
Fmov(dest64, fsrc64);
|
Fmov(dest64, fsrc64);
|
||||||
Cbnz(dest64, fail);
|
Cmp(dest64, xzr);
|
||||||
|
B(fail, Assembler::Signed);
|
||||||
|
Mov(dest64, xzr);
|
||||||
bind(&nonzero);
|
bind(&nonzero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -651,8 +654,11 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
|
||||||
if (negativeZeroCheck) {
|
if (negativeZeroCheck) {
|
||||||
Label nonzero;
|
Label nonzero;
|
||||||
Cbnz(dest32, &nonzero);
|
Cbnz(dest32, &nonzero);
|
||||||
|
// dest32 is 0, fail if fsrc64 is negative.
|
||||||
Fmov(dest32, fsrc);
|
Fmov(dest32, fsrc);
|
||||||
Cbnz(dest32, fail);
|
Cmp(dest32, xzr);
|
||||||
|
B(fail, Assembler::Signed);
|
||||||
|
Mov(dest32, xzr);
|
||||||
bind(&nonzero);
|
bind(&nonzero);
|
||||||
}
|
}
|
||||||
Uxtw(dest64, dest64);
|
Uxtw(dest64, dest64);
|
||||||
|
|
@ -678,8 +684,11 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
|
||||||
if (negativeZeroCheck) {
|
if (negativeZeroCheck) {
|
||||||
Label nonzero;
|
Label nonzero;
|
||||||
Cbnz(dest64, &nonzero);
|
Cbnz(dest64, &nonzero);
|
||||||
|
// dest64 is 0, fail if fsrc64 is negative.
|
||||||
Fmov(dest64, fsrc64);
|
Fmov(dest64, fsrc64);
|
||||||
Cbnz(dest64, fail);
|
Cmp(dest64, xzr);
|
||||||
|
B(fail, Assembler::Signed);
|
||||||
|
Mov(dest64, xzr);
|
||||||
bind(&nonzero);
|
bind(&nonzero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue