summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-08-17 18:33:25 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-08-17 18:33:25 -0700
commit8d37ce8652574405c187f2b1a364c5fd30e7d9b9 (patch)
tree3b9d3f6c0f14bbfd1204d5366c69e9a02f91e9ff /src
parent34f528bd95685e8675bd28d02c51ae3eb549c196 (diff)
downloadgem5-8d37ce8652574405c187f2b1a364c5fd30e7d9b9.tar.xz
X86: Implement the floating point media max microop.
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/isa/microops/mediaop.isa50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa
index 15bae742a..5cd7bd4f5 100644
--- a/src/arch/x86/isa/microops/mediaop.isa
+++ b/src/arch/x86/isa/microops/mediaop.isa
@@ -479,4 +479,54 @@ let {{
}
FpDestReg.uqw = result;
'''
+
+ class Mmaxf(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;
+ assert(srcSize == 4 || srcSize == 8);
+ int items = (ext & 0x1) ? 1: (sizeof(FloatRegBits) / size);
+ uint64_t result = FpDestReg.uqw;
+
+ for (int i = 0; i < items; i++) {
+ double arg1, arg2;
+ int hiIndex = (i + 1) * sizeBits - 1;
+ int loIndex = (i + 0) * sizeBits;
+ uint64_t arg1Bits = bits(FpSrcReg1.uqw, hiIndex, loIndex);
+ uint64_t arg2Bits = bits(FpSrcReg2.uqw, hiIndex, loIndex);
+
+ if (size == 4) {
+ floatInt fi;
+ fi.i = arg1Bits;
+ arg1 = fi.f;
+ fi.i = arg2Bits;
+ arg2 = fi.f;
+ } else {
+ doubleInt di;
+ di.i = arg1Bits;
+ arg1 = di.d;
+ di.i = arg2Bits;
+ arg2 = di.d;
+ }
+
+ if (arg1 > arg2) {
+ result = insertBits(result, hiIndex, loIndex, arg1Bits);
+ } else {
+ result = insertBits(result, hiIndex, loIndex, arg2Bits);
+ }
+ }
+ FpDestReg.uqw = result;
+ '''
}};