diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2009-08-17 20:22:56 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2009-08-17 20:22:56 -0700 |
commit | 965e546df30983ebf52c1dea790ef04d9a507292 (patch) | |
tree | 847e76e4197ab7de899041babb3935e702ca0bc6 /src | |
parent | 2beab367d75e5f6cc30a194ac4d8160b50fb29a7 (diff) | |
download | gem5-965e546df30983ebf52c1dea790ef04d9a507292.tar.xz |
X86: Extend mov2int and mov2fp so they can support insert and extract instructions.
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/x86/isa/microops/mediaop.isa | 43 |
1 files changed, 32 insertions, 11 deletions
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): |