From: Gabe Black Date: Tue, 18 Aug 2009 03:04:03 +0000 (-0700) Subject: X86: Implement an integer media max microop. X-Git-Tag: Calvin_Submission~79 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9a954c77a1fb59092f8165b3fe3d3dd75848cd6;p=gem5.git X86: Implement an integer media max microop. --- diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa index b3ff5cde2..08ba14b00 100644 --- a/src/arch/x86/isa/microops/mediaop.isa +++ b/src/arch/x86/isa/microops/mediaop.isa @@ -568,6 +568,44 @@ let {{ FpDestReg.uqw = result; ''' + class Mmaxi(MediaOp): + code = ''' + + assert(srcSize == destSize); + int size = srcSize; + int sizeBits = size * 8; + int items = (ext & 0x1) ? 1: (sizeof(FloatRegBits) / size); + uint64_t result = FpDestReg.uqw; + + for (int i = 0; i < items; i++) { + int hiIndex = (i + 1) * sizeBits - 1; + int loIndex = (i + 0) * sizeBits; + uint64_t arg1Bits = bits(FpSrcReg1.uqw, hiIndex, loIndex); + int64_t arg1 = arg1Bits | + (0 - (arg1Bits & (1 << (sizeBits - 1)))); + uint64_t arg2Bits = bits(FpSrcReg2.uqw, hiIndex, loIndex); + int64_t arg2 = arg2Bits | + (0 - (arg2Bits & (1 << (sizeBits - 1)))); + uint64_t resBits; + + if (ext & 0x2) { + if (arg1 > arg2) { + resBits = arg1Bits; + } else { + resBits = arg2Bits; + } + } else { + if (arg1Bits > arg2Bits) { + resBits = arg1Bits; + } else { + resBits = arg2Bits; + } + } + result = insertBits(result, hiIndex, loIndex, resBits); + } + FpDestReg.uqw = result; + ''' + class Msqrt(MediaOp): def __init__(self, dest, src, \ size = None, destSize = None, srcSize = None, ext = None):