Skip to content

Commit 41c29dc

Browse files
mmereckisys_zuul
authored andcommitted
Add a legalization check on scalar byte to half conversion.
Change-Id: Ib9a7dbd599e4aa45952ab036d490d2e82f3cea40
1 parent 438ffb3 commit 41c29dc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

visa/HWConformity.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,8 @@ static bool canReplaceMovSrcType(IR_Builder& builder, G4_INST* inst, uint32_t ex
13961396
// Use two instructions and F (Float) as an intermediate type.
13971397
// -- There is no direct conversion from HF to Q/UQ or Q/UQ to HF.
13981398
// Use two instructions and F (Float) or a word integer type or a DWord integer type as an intermediate type.
1399+
// -- There is no direct scalar conversion from B/UB to HF or F.
1400+
// Use two instructions and a WORD or DWORD intermediate type respectively.
13991401
// returns true if a move is inserted
14001402
bool HWConformity::fixMov(INST_LIST_ITER i, G4_BB* bb)
14011403
{
@@ -1410,8 +1412,10 @@ bool HWConformity::fixMov(INST_LIST_ITER i, G4_BB* bb)
14101412
G4_Type srcType = inst->getSrc(0)->getType();
14111413
auto src = inst->getSrc(0);
14121414

1413-
bool scalarByteToFloat = builder.noScalarByteToFloat() && IS_BTYPE(srcType) &&
1414-
IS_FTYPE(dstType) && src->isSrcRegRegion() && src->asSrcRegRegion()->isScalar();
1415+
bool scalarByteToFloat = builder.noScalarByteToFloat() &&
1416+
IS_BTYPE(srcType) &&
1417+
(IS_FTYPE(dstType) || IS_HFTYPE(dstType)) &&
1418+
(src->isSrcRegRegion() && src->asSrcRegRegion()->isScalar());
14151419
bool dstByteSrc64b = IS_BTYPE(dstType) && (IS_DFTYPE(srcType) || IS_QTYPE(srcType));
14161420

14171421
if (scalarByteToFloat || dstByteSrc64b)

0 commit comments

Comments
 (0)