File tree Expand file tree Collapse file tree 2 files changed +13
-30
lines changed Expand file tree Collapse file tree 2 files changed +13
-30
lines changed Original file line number Diff line number Diff line change @@ -857,31 +857,9 @@ CVariable* CShader::GetGlobalCVar(llvm::Value* value)
857857CVariable* CShader::BitCast (CVariable* var, VISA_Type newType)
858858{
859859 CVariable* bitCast = nullptr ;
860- uint32_t newEltSz = CEncoder::GetCISADataTypeSize (newType);
861- uint32_t eltSz = var->GetElemSize ();
862- // Bitcase requires both src and dst have the same size. Thus, they
863- // are either equal or one is a multiple of the other.
864- IGC_ASSERT ( (newEltSz >= eltSz && (newEltSz % eltSz) == 0 )
865- || (newEltSz < eltSz && (eltSz% newEltSz) == 0 ));
866860 if (var->IsImmediate ())
867861 {
868- if (newEltSz == eltSz)
869- bitCast = ImmToVariable (var->GetImmediateValue (), newType);
870- else
871- {
872- // Need a temp. For example, bitcast i64 0 -> 2xi32
873- CVariable* tmp = GetNewVariable (
874- 1 ,
875- var->GetType (),
876- CEncoder::GetCISADataTypeAlignment (var->GetType ()),
877- true ,
878- 1 ,
879- " vecImmBitCast" );
880- encoder.Copy (tmp, var);
881- encoder.Push ();
882-
883- bitCast = GetNewAlias (tmp, newType, 0 , 0 );
884- }
862+ bitCast = ImmToVariable (var->GetImmediateValue (), newType);
885863 }
886864 else
887865 {
Original file line number Diff line number Diff line change @@ -14460,21 +14460,26 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
1446014460 dstNElts = 1;
1446114461 }
1446214462
14463- uint32_t dstEltBytes = int_cast<uint32_t>((unsigned int)dstEltTy->getPrimitiveSizeInBits() / 8);
14464- uint32_t srcEltBytes = int_cast<uint32_t>((unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8);
1446514463 if (src->IsImmediate())
1446614464 {
14467- IGC_ASSERT((dstNElts * dstEltBytes) == srcEltBytes && srcNElts == 1);
14468- CVariable* tmp = m_currShader->GetNewAlias(m_destination, src->GetType(), 0, 0);
14469- m_encoder->Copy(tmp, src);
14465+ CVariable* reg = m_currShader->GetNewVariable(
14466+ 1,
14467+ src->GetType(),
14468+ m_encoder->GetCISADataTypeAlignment(src->GetType()),
14469+ true,
14470+ 1, CName::NONE);
14471+
14472+ m_encoder->Copy(reg, src);
1447014473 m_encoder->Push();
14471- return;
14474+
14475+ src = reg;
1447214476 }
1447314477
1447414478 uint32_t width = numLanes(m_currShader->m_SIMDSize);
14479+ uint32_t dstEltBytes = int_cast<uint32_t>((unsigned int)dstEltTy->getPrimitiveSizeInBits() / 8);
14480+ uint32_t srcEltBytes = int_cast<uint32_t>((unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8);
1447514481 bool srcUniform = src->IsUniform();
1447614482 bool dstUniform = m_destination->IsUniform();
14477-
1447814483 if (srcUniform && dstUniform &&
1447914484 (dstNElts == 2 || dstNElts == 4 || dstNElts == 8) &&
1448014485 m_destination != src &&
You can’t perform that action at this time.
0 commit comments