# Node ID b05562ad3992bcd2b714e72bd950d77bbaffa224 # Parent 76f66fb554d810476177077b086a3ee3c0a7bd59 diff --git a/src/arch/x86/isa/microops/regop.isa b/src/arch/x86/isa/microops/regop.isa --- a/src/arch/x86/isa/microops/regop.isa +++ b/src/arch/x86/isa/microops/regop.isa @@ -548,16 +548,19 @@ code = ''' ProdLow = psrc1 * op2; - int halfSize = (dataSize * 8) / 2; - uint64_t shifter = (ULL(1) << halfSize); + int shifter = (dataSize * 8) / 2; uint64_t hiResult; - uint64_t psrc1_h = psrc1 / shifter; - uint64_t psrc1_l = psrc1 & mask(halfSize); - uint64_t psrc2_h = (op2 / shifter) & mask(halfSize); - uint64_t psrc2_l = op2 & mask(halfSize); - hiResult = ((psrc1_l * psrc2_h + psrc1_h * psrc2_l + - ((psrc1_l * psrc2_l) / shifter)) /shifter) + - psrc1_h * psrc2_h; + uint64_t psrc1_h = (psrc1 >> shifter) & mask(shifter); + uint64_t psrc1_l = psrc1 & mask(shifter); + uint64_t psrc2_h = (op2 >> shifter) & mask(shifter); + uint64_t psrc2_l = op2 & mask(shifter); + + hiResult = psrc1_h * psrc2_h + ((psrc1_h * psrc2_l) >> shifter) + + ((psrc1_l * psrc2_h) >> shifter) + + ((((psrc1_l * psrc2_h) & 0xffffffff) + + ((psrc1_h * psrc2_l) & 0xffffffff) + + ((psrc1_l * psrc2_l) >> shifter)) >> shifter); + if (bits(psrc1, dataSize * 8 - 1)) hiResult -= op2; if (bits(op2, dataSize * 8 - 1)) @@ -580,15 +583,17 @@ code = ''' ProdLow = psrc1 * op2; - int halfSize = (dataSize * 8) / 2; - uint64_t shifter = (ULL(1) << halfSize); - uint64_t psrc1_h = psrc1 / shifter; - uint64_t psrc1_l = psrc1 & mask(halfSize); - uint64_t psrc2_h = (op2 / shifter) & mask(halfSize); - uint64_t psrc2_l = op2 & mask(halfSize); - ProdHi = ((psrc1_l * psrc2_h + psrc1_h * psrc2_l + - ((psrc1_l * psrc2_l) / shifter)) / shifter) + - psrc1_h * psrc2_h; + int shifter = (dataSize * 8) / 2; + uint64_t psrc1_h = (psrc1 >> shifter) & mask(shifter); + uint64_t psrc1_l = psrc1 & mask(shifter); + uint64_t psrc2_h = (op2 >> shifter) & mask(shifter); + uint64_t psrc2_l = op2 & mask(shifter); + + ProdHi = psrc1_h * psrc2_h + ((psrc1_h * psrc2_l) >> shifter) + + ((psrc1_l * psrc2_h) >> shifter) + + ((((psrc1_l * psrc2_h) & 0xffffffff) + + ((psrc1_h * psrc2_l) & 0xffffffff) + + ((psrc1_l * psrc2_l) >> shifter)) >> shifter); ''' flag_code = ''' if (ProdHi) {