@@ -9597,7 +9597,7 @@ void EmitPass::emitStackCall(llvm::CallInst* inst)
95979597 CVariable* pStackOffset = m_currShader->ImmToVariable(RdBytes, ISA_TYPE_UD);
95989598 emitAddSP(pTempVar, pSP, pStackOffset);
95999599
9600- bool needRmCopy = RdSize == SIZE_OWORD && RmnBytes < SIZE_OWORD;
9600+ bool needRmCopy = RdSize == SIZE_OWORD && RmnBytes > 0 && RmnBytes < SIZE_OWORD;
96019601 if (!needRmCopy)
96029602 {
96039603 if (is64BitSP)
@@ -9619,9 +9619,9 @@ void EmitPass::emitStackCall(llvm::CallInst* inst)
96199619 if (is64BitSP)
96209620 m_encoder->OWLoadA64(pTempDst, pTempVar, SIZE_OWORD);
96219621 else
9622- m_encoder->OWLoad(pTempDst, resource, pTempVar, false, RdSize );
9622+ m_encoder->OWLoad(pTempDst, resource, pTempVar, false, SIZE_OWORD );
96239623 m_encoder->Push();
9624- emitVectorCopy(Dst, pTempDst, RdSize / elemSize, RdBytes, 0);
9624+ emitVectorCopy(Dst, pTempDst, RmnBytes / elemSize, RdBytes, 0);
96259625 }
96269626 }
96279627 RdBytes += RdSize;
@@ -9770,7 +9770,8 @@ void EmitPass::emitStackFuncEntry(Function* F, bool ptr64bits)
97709770 EALIGN_HWORD, false, 1);
97719771 }
97729772
9773- bool needRmCopy = RdSize == SIZE_OWORD && LdDst->GetSize() < (DstOffset + RdSize);
9773+ int RmnBytes = LdDst->GetSize() - DstOffset;
9774+ bool needRmCopy = RdSize == SIZE_OWORD && RmnBytes > 0 && RmnBytes < SIZE_OWORD;
97749775 if (!needRmCopy)
97759776 {
97769777 if (is64bitSP)
@@ -9793,9 +9794,9 @@ void EmitPass::emitStackFuncEntry(Function* F, bool ptr64bits)
97939794 if (is64bitSP)
97949795 m_encoder->OWLoadA64(pTempDst, pTempVar, SIZE_OWORD);
97959796 else
9796- m_encoder->OWLoad(pTempDst, resource, pTempVar, false, RdSize );
9797+ m_encoder->OWLoad(pTempDst, resource, pTempVar, false, SIZE_OWORD );
97979798 m_encoder->Push();
9798- emitVectorCopy(LdDst, pTempDst, RdSize / ldDstElemSize, DstOffset, 0);
9799+ emitVectorCopy(LdDst, pTempDst, RmnBytes / ldDstElemSize, DstOffset, 0);
97999800 }
98009801 }
98019802 if (LdDst != Dst)
0 commit comments