Bug 1656229 - replace a computation by a constant load. r=jseward

This is technical debt from the initial SIMD work - it's faster to load a
constant here than to compute it.  Benchmark data not forthcoming, but
elsewhere i've found that we break even at two instructions and it's
better to load the value than to compute it in three.

Differential Revision: https://phabricator.services.mozilla.com/D87306
This commit is contained in:
Lars T Hansen 2020-08-20 14:43:04 +00:00
Родитель 889191a3c7
Коммит a64bb98703
1 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -2016,12 +2016,10 @@ void MacroAssemblerX86Shared::unsignedTruncSatFloat32x4ToInt32x4(
vpxor(Operand(scratch), scratch, scratch);
vmaxps(Operand(scratch), dest, dest);
// Compute the float value of 0x7FFFFFFF (the largest positive signed integer
// value) in all lanes in scratch. We use it to bias the conversion to handle
// edge cases.
vpcmpeqd(Operand(scratch), scratch, scratch);
vpsrld(Imm32(1), scratch, scratch);
vcvtdq2ps(scratch, scratch);
// Place the largest positive signed integer in all lanes in scratch.
// We use it to bias the conversion to handle edge cases.
asMasm().loadConstantSimd128Float(SimdConstant::SplatX4(2147483647.f),
scratch);
// temp = dest - 7FFFFFFFh (as floating), this brings integers in the unsigned
// range but above the signed range into the signed range; 0 => -7FFFFFFFh.