From: Gabe Black Date: Mon, 27 Aug 2007 03:37:41 +0000 (-0700) Subject: X86: Fix the sign extension microop so it extends zeros correctly. X-Git-Tag: m5_2.0_beta4~168 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c99f5f825a3440ce8efef2e31f801527c5939d6;p=gem5.git X86: Fix the sign extension microop so it extends zeros correctly. --HG-- extra : convert_revision : 9d7ca286ba7709175fa75226320601acce4ced98 --- diff --git a/src/arch/x86/isa/microops/regop.isa b/src/arch/x86/isa/microops/regop.isa index 608b86a70..b91c77c21 100644 --- a/src/arch/x86/isa/microops/regop.isa +++ b/src/arch/x86/isa/microops/regop.isa @@ -661,8 +661,10 @@ let {{ defineMicroRegOpImm('Sext', ''' IntReg val = psrc1; int sign_bit = bits(val, imm8-1, imm8-1); - val = sign_bit ? (val | ~mask(imm8)) : val; - DestReg = merge(DestReg, val, dataSize);''') + uint64_t maskVal = mask(imm8); + val = sign_bit ? (val | ~maskVal) : (val & maskVal); + DestReg = merge(DestReg, val, dataSize); + ''') defineMicroRegOpImm('Zext', 'DestReg = bits(psrc1, imm8-1, 0);') }};