summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/isa/microops/regop.isa6
1 files changed, 4 insertions, 2 deletions
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);')
}};