From 9c99f5f825a3440ce8efef2e31f801527c5939d6 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 26 Aug 2007 20:37:41 -0700 Subject: [PATCH] X86: Fix the sign extension microop so it extends zeros correctly. --HG-- extra : convert_revision : 9d7ca286ba7709175fa75226320601acce4ced98 --- src/arch/x86/isa/microops/regop.isa | 6 ++++-- 1 file 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);') }}; -- 2.30.2