From: Gabe Black Date: Tue, 18 Aug 2009 03:22:56 +0000 (-0700) Subject: X86: Extend mov2int and mov2fp so they can support insert and extract instructions. X-Git-Tag: Calvin_Submission~64 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=965e546df30983ebf52c1dea790ef04d9a507292;p=gem5.git X86: Extend mov2int and mov2fp so they can support insert and extract instructions. --- diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa index b771cca83..981ffc74b 100644 --- a/src/arch/x86/isa/microops/mediaop.isa +++ b/src/arch/x86/isa/microops/mediaop.isa @@ -289,24 +289,45 @@ let {{ return allocator class Mov2int(MediaOp): - def __init__(self, dest, src, \ + def __init__(self, dest, src1, src2 = 0, \ size = None, destSize = None, srcSize = None, ext = None): - super(Mov2int, self).__init__(dest, src,\ - "InstRegIndex(0)", size, destSize, srcSize, ext) + super(Mov2int, self).__init__(dest, src1,\ + src2, size, destSize, srcSize, ext) code = ''' - uint64_t fpSrcReg1 = bits(FpSrcReg1.uqw, srcSize * 8 - 1, 0); - DestReg = merge(DestReg, fpSrcReg1, destSize); + int items = sizeof(FloatRegBits) / srcSize; + int offset = imm8; + if (bits(src1, 0) && (ext & 0x1)) + offset -= items; + if (offset >= 0 && offset < items) { + uint64_t fpSrcReg1 = + bits(FpSrcReg1.uqw, + (offset + 1) * srcSize * 8 - 1, + (offset + 0) * srcSize * 8); + DestReg = merge(0, fpSrcReg1, destSize); + } else { + DestReg = DestReg; + } ''' class Mov2fp(MediaOp): - def __init__(self, dest, src, \ + def __init__(self, dest, src1, src2 = 0, \ size = None, destSize = None, srcSize = None, ext = None): - super(Mov2fp, self).__init__(dest, src,\ - "InstRegIndex(0)", size, destSize, srcSize, ext) + super(Mov2fp, self).__init__(dest, src1,\ + src2, size, destSize, srcSize, ext) code = ''' - uint64_t srcReg1 = pick(SrcReg1, 0, srcSize); - FpDestReg.uqw = - insertBits(FpDestReg.uqw, destSize * 8 - 1, 0, srcReg1); + int items = sizeof(FloatRegBits) / destSize; + int offset = imm8; + if (bits(dest, 0) && (ext & 0x1)) + offset -= items; + if (offset >= 0 && offset < items) { + uint64_t srcReg1 = pick(SrcReg1, 0, srcSize); + FpDestReg.uqw = + insertBits(FpDestReg.uqw, + (offset + 1) * destSize * 8 - 1, + (offset + 0) * destSize * 8, srcReg1); + } else { + FpDestReg.uqw = FpDestReg.uqw; + } ''' class Unpack(MediaOp):