A64: Handle half-precision floating point in FCVTL
Like FCVTN, now that we have half-precision floating point conversion functions available, we can go ahead and use those to eliminate the interpreter fallback.
This commit is contained in:
parent
fac9224d5e
commit
d7ac5a664f
1 changed files with 12 additions and 7 deletions
|
@ -342,19 +342,24 @@ bool TranslatorVisitor::FCMLT_4(bool Q, bool sz, Vec Vn, Vec Vd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::FCVTL(bool Q, bool sz, Vec Vn, Vec Vd) {
|
bool TranslatorVisitor::FCVTL(bool Q, bool sz, Vec Vn, Vec Vd) {
|
||||||
// Half-precision not handled directly.
|
const size_t esize = sz ? 32 : 16;
|
||||||
if (!sz) {
|
const size_t datasize = 64;
|
||||||
return InterpretThisInstruction();
|
const size_t num_elements = datasize / esize;
|
||||||
}
|
|
||||||
|
|
||||||
const IR::U128 part = Vpart(64, Vn, Q);
|
const IR::U128 part = Vpart(64, Vn, Q);
|
||||||
const auto rounding_mode = ir.current_location->FPCR().RMode();
|
const auto rounding_mode = ir.current_location->FPCR().RMode();
|
||||||
IR::U128 result = ir.ZeroVector();
|
IR::U128 result = ir.ZeroVector();
|
||||||
|
|
||||||
for (size_t i = 0; i < 2; i++) {
|
for (size_t i = 0; i < num_elements; i++) {
|
||||||
const IR::U64 element = ir.FPSingleToDouble(ir.VectorGetElement(32, part, i), rounding_mode);
|
IR::U16U32U64 element = ir.VectorGetElement(esize, part, i);
|
||||||
|
|
||||||
result = ir.VectorSetElement(64, result, i, element);
|
if (esize == 16) {
|
||||||
|
element = ir.FPHalfToSingle(element, rounding_mode);
|
||||||
|
} else if (esize == 32) {
|
||||||
|
element = ir.FPSingleToDouble(element, rounding_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = ir.VectorSetElement(2 * esize, result, i, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
V(128, Vd, result);
|
V(128, Vd, result);
|
||||||
|
|
Loading…
Reference in a new issue