File tree Expand file tree Collapse file tree 3 files changed +51
-1
lines changed
Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -6191,6 +6191,53 @@ G4_Imm::emitAutoFmt(std::ostream& output)
61916191 }
61926192}
61936193
6194+ int64_t G4_Imm::typecastVals (int64_t value, G4_Type type)
6195+ {
6196+ int64_t retVal = 0 ;
6197+ switch (type)
6198+ {
6199+ case Type_UD:
6200+ case Type_UV:
6201+ case Type_VF:
6202+ {
6203+ retVal = (int64_t )((unsigned int )value);
6204+ break ;
6205+ }
6206+ case Type_D:
6207+ case Type_V:
6208+ {
6209+ retVal = (int64_t )((int )value);
6210+ break ;
6211+ }
6212+ case Type_UW:
6213+ {
6214+ retVal = (int64_t )((uint16_t )value);
6215+ break ;
6216+ }
6217+ case Type_W:
6218+ {
6219+ retVal = (int64_t )((int16_t )value);
6220+ break ;
6221+ }
6222+ case Type_UB:
6223+ {
6224+ retVal = (int64_t )((uint8_t )value);
6225+ break ;
6226+ }
6227+ case Type_B:
6228+ {
6229+ retVal = (int64_t )((int8_t )value);
6230+ break ;
6231+ }
6232+ default :
6233+ {
6234+ // Dont do float conversions
6235+ retVal = value;
6236+ }
6237+ }
6238+ return retVal;
6239+ }
6240+
61946241G4_RegVar *
61956242G4_RegVarTransient::getNonTransientBaseRegVar ()
61966243{
Original file line number Diff line number Diff line change @@ -2480,6 +2480,7 @@ class G4_Imm : public G4_Operand
24802480
24812481 static bool isInTypeRange (int64_t imm, G4_Type ty);
24822482
2483+ static int64_t typecastVals (int64_t value, G4_Type type);
24832484};
24842485
24852486class G4_Reloc_Imm : public G4_Imm
Original file line number Diff line number Diff line change @@ -2950,7 +2950,9 @@ void Optimizer::newLocalCopyPropagation()
29502950 // replace use with def
29512951 if (src->isImm ())
29522952 {
2953- G4_Imm* newImm = builder.createImm (src->asImm ()->getImm (),
2953+ auto newImmVal = G4_Imm::typecastVals (src->asImm ()->getImm (),
2954+ propType);
2955+ G4_Imm* newImm = builder.createImm (newImmVal,
29542956 propType);
29552957 G4_SrcModifier modifier = use->asSrcRegRegion ()->getModifier ();
29562958 if (modifier != Mod_src_undef)
You can’t perform that action at this time.
0 commit comments