From 860f0f835097e884d15069af22efec9c8d766b4e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 5 Aug 2009 02:57:47 -0700 Subject: X86: Fix sign extension when doing an arithmetic shift right by 0. --- src/arch/x86/isa/microops/regop.isa | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/x86/isa/microops/regop.isa b/src/arch/x86/isa/microops/regop.isa index e86e9f00a..4d4079f5f 100644 --- a/src/arch/x86/isa/microops/regop.isa +++ b/src/arch/x86/isa/microops/regop.isa @@ -700,7 +700,7 @@ let {{ // Because what happens to the bits shift -in- on a right shift // is not defined in the C/C++ standard, we have to sign extend // them manually to be sure. - uint64_t arithMask = + uint64_t arithMask = (shiftAmt == 0) ? 0 : -bits(psrc1, dataSize * 8 - 1) << (dataSize * 8 - shiftAmt); DestReg = merge(DestReg, (psrc1 >> shiftAmt) | arithMask, dataSize); ''' -- cgit v1.2.3