diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2009-08-17 20:04:02 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2009-08-17 20:04:02 -0700 |
commit | f122c93faa00e503a58c2f4050e4b2c7664912a3 (patch) | |
tree | be0886800c30a9ceaedc78baca3a2ae995ae17f5 /src/arch/x86/isa/microops/mediaop.isa | |
parent | df1b3fdcfba3039122d8b2ded5e64200fec6eebd (diff) | |
download | gem5-f122c93faa00e503a58c2f4050e4b2c7664912a3.tar.xz |
X86: Implement a microop that compares fp values and writes a mask as its result.
Diffstat (limited to 'src/arch/x86/isa/microops/mediaop.isa')
-rw-r--r-- | src/arch/x86/isa/microops/mediaop.isa | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa index 641f37865..2995a82d1 100644 --- a/src/arch/x86/isa/microops/mediaop.isa +++ b/src/arch/x86/isa/microops/mediaop.isa @@ -818,4 +818,43 @@ let {{ } FpDestReg.uqw = result; ''' + + class Mcmpi2r(MediaOp): + code = ''' + union floatInt + { + float f; + uint32_t i; + }; + union doubleInt + { + double d; + uint64_t i; + }; + + 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 = 0; + if ((ext & 0x2) == 0 && arg1 == arg2 || + (ext & 0x2) == 0x2 && arg1 > arg2) + resBits = mask(sizeBits); + + result = insertBits(result, hiIndex, loIndex, resBits); + } + FpDestReg.uqw = result; + ''' }}; |