Bug 1700458 - Fix fcvtn/fcvtxn when dst == src. r=nbp

Patch sync from 202f1c03f4

Differential Revision: https://phabricator.services.mozilla.com/D109542
This commit is contained in:
Yury Delendik 2021-03-25 18:57:36 +00:00
Родитель 1dcdf4e04c
Коммит 2fb73f392b
2 изменённых файлов: 23 добавлений и 4 удалений

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

@ -2148,6 +2148,17 @@ LogicVRegister Simulator::ins_immediate(VectorFormat vform,
}
LogicVRegister Simulator::mov(VectorFormat vform,
LogicVRegister dst,
const LogicVRegister& src) {
dst.ClearForWrite(vform);
for (int lane = 0; lane < LaneCountFromFormat(vform); lane++) {
dst.SetUint(vform, lane, src.Uint(vform, lane));
}
return dst;
}
LogicVRegister Simulator::movi(VectorFormat vform,
LogicVRegister dst,
uint64_t imm) {
@ -4303,17 +4314,20 @@ LogicVRegister Simulator::fcvtl2(VectorFormat vform,
LogicVRegister Simulator::fcvtn(VectorFormat vform,
LogicVRegister dst,
const LogicVRegister& src) {
SimVRegister tmp;
LogicVRegister srctmp = mov(kFormat2D, tmp, src);
dst.ClearForWrite(vform);
if (LaneSizeInBitsFromFormat(vform) == kHRegSize) {
for (int i = 0; i < LaneCountFromFormat(vform); i++) {
dst.SetFloat(i,
Float16ToRawbits(
FPToFloat16(src.Float<float>(i), FPTieEven, ReadDN())));
Float16ToRawbits(FPToFloat16(srctmp.Float<float>(i),
FPTieEven,
ReadDN())));
}
} else {
VIXL_ASSERT(LaneSizeInBitsFromFormat(vform) == kSRegSize);
for (int i = 0; i < LaneCountFromFormat(vform); i++) {
dst.SetFloat(i, FPToFloat(src.Float<double>(i), FPTieEven, ReadDN()));
dst.SetFloat(i, FPToFloat(srctmp.Float<double>(i), FPTieEven, ReadDN()));
}
}
return dst;
@ -4344,10 +4358,12 @@ LogicVRegister Simulator::fcvtn2(VectorFormat vform,
LogicVRegister Simulator::fcvtxn(VectorFormat vform,
LogicVRegister dst,
const LogicVRegister& src) {
SimVRegister tmp;
LogicVRegister srctmp = mov(kFormat2D, tmp, src);
dst.ClearForWrite(vform);
VIXL_ASSERT(LaneSizeInBitsFromFormat(vform) == kSRegSize);
for (int i = 0; i < LaneCountFromFormat(vform); i++) {
dst.SetFloat(i, FPToFloat(src.Float<double>(i), FPRoundOdd, ReadDN()));
dst.SetFloat(i, FPToFloat(srctmp.Float<double>(i), FPRoundOdd, ReadDN()));
}
return dst;
}

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

@ -1574,6 +1574,9 @@ class Simulator : public DecoderVisitor {
LogicVRegister dup_immediate(VectorFormat vform,
LogicVRegister dst,
uint64_t imm);
LogicVRegister mov(VectorFormat vform,
LogicVRegister dst,
const LogicVRegister& src);
LogicVRegister movi(VectorFormat vform,
LogicVRegister dst,
uint64_t imm);