From 7bc0d6b902282888e15b6ad1fc04cb1b66278b9e Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Fri, 10 Jan 2025 13:37:19 -0800 Subject: [PATCH] xe: jit: use switch for qword mov emulation Simplifies logic for which cases are supported. Additionally enables a few more simple conversions. --- src/gpu/intel/jit/emulation.hpp | 60 +++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/gpu/intel/jit/emulation.hpp b/src/gpu/intel/jit/emulation.hpp index 40156af2d6f..d9ce68f07dc 100644 --- a/src/gpu/intel/jit/emulation.hpp +++ b/src/gpu/intel/jit/emulation.hpp @@ -261,32 +261,48 @@ struct EmulationImplementation { bool dstQ = isQW(dst); bool s0Q = isQW(src0); - bool s0D = isDW(src0); bool isDF = (src0.getType() == DataType::df && dst.getType() == DataType::df); bool unaligned = (mod.getExecSize() > 1 && src0.getHS() != 0 && src0.getOffset() != dst.getOffset()); - - if ((dstQ && s0D) && strategy.emulate64) { - if (src0.getNeg()) stub(); - bool s0Signed = isSigned(src0.getType()); - RegData dstHi, dstLo; - splitToDW(dst, dstLo, dstHi); - g.mov(mod, dstLo, src0); - if (!s0Signed) - g.mov(mod, dstHi, 0); - else - g.asr(mod, dstHi, dstLo, uint16_t(31)); - } else if (((dstQ || s0Q) && strategy.emulate64) - || (isDF && unaligned && g.hardware >= ngen::HW::XeHP)) { - if (dstQ != s0Q) stub(); - - auto mod2x = mod; - mod2x.setExecSize(mod.getExecSize() * 2); - - makeDWPair(dst, mod.getExecSize()); - makeDWPair(src0, mod.getExecSize()); - g.mov(mod2x, dst, src0); + bool emulateDF = isDF && unaligned && g.hardware >= ngen::HW::XeHP; + + if ((strategy.emulate64 && dstQ) || emulateDF) { + switch (src0.getType()) { + case DataType::ub: + case DataType::uw: + case DataType::ud: { + RegData dstHi, dstLo; + splitToDW(dst, dstLo, dstHi); + g.mov(mod, dstLo, src0); + g.mov(mod, dstHi, 0); + break; + } + case DataType::d: { + if (src0.getNeg()) stub(); + RegData dstHi, dstLo; + splitToDW(dst, dstLo, dstHi); + g.mov(mod, dstLo, src0); + g.asr(mod, dstHi, dstLo, uint16_t(31)); + break; + } + case DataType::q: + case DataType::uq: + case DataType::df: { + if (dstQ != s0Q) stub(); + + auto mod2x = mod; + mod2x.setExecSize(mod.getExecSize() * 2); + + makeDWPair(dst, mod.getExecSize()); + makeDWPair(src0, mod.getExecSize()); + g.mov(mod2x, dst, src0); + break; + } + default: stub(); break; + } + } else if (strategy.emulate64 && s0Q) { + stub(); } else if (dst.getType() == DataType::f && src0.getType() == DataType::bf && (src0.getHS() != 1 || mod.getExecSize() == 1)) {