From 90786e43fc8ba16d6e1941ca996e82e94f186e5e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 Aug 2009 20:22:56 -0700 Subject: X86: Implement a microop that moves sign bits. --- src/arch/x86/isa/microops/mediaop.isa | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa index 981ffc74b..bef661848 100644 --- a/src/arch/x86/isa/microops/mediaop.isa +++ b/src/arch/x86/isa/microops/mediaop.isa @@ -330,6 +330,23 @@ let {{ } ''' + class Movsign(MediaOp): + def __init__(self, dest, src, \ + size = None, destSize = None, srcSize = None, ext = None): + super(Movsign, self).__init__(dest, src,\ + "InstRegIndex(0)", size, destSize, srcSize, ext) + code = ''' + int items = sizeof(FloatRegBits) / srcSize; + uint64_t result = 0; + int offset = (ext & 0x1) ? items : 0; + for (int i = 0; i < items; i++) { + uint64_t picked = + bits(FpSrcReg1.uqw, (i + 1) * 8 * srcSize - 1); + result = insertBits(result, i + offset, i + offset, picked); + } + DestReg = DestReg | result; + ''' + class Unpack(MediaOp): code = ''' assert(srcSize == destSize); -- cgit v1.2.3