summaryrefslogtreecommitdiff
path: root/src/arch/x86/isa
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-08-17 18:38:51 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-08-17 18:38:51 -0700
commit94e771e283265700de82b41aaeea33a4fdfd9ac0 (patch)
tree6572809557d51385d42ed043411e39b0080358cb /src/arch/x86/isa
parentdd81a34829ec578d24d43b4d3fc7a4a16622720e (diff)
downloadgem5-94e771e283265700de82b41aaeea33a4fdfd9ac0.tar.xz
X86: Implement a floating point media multiply microop.
Diffstat (limited to 'src/arch/x86/isa')
-rw-r--r--src/arch/x86/isa/microops/mediaop.isa46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa
index b9cfc0075..16cfbb5f9 100644
--- a/src/arch/x86/isa/microops/mediaop.isa
+++ b/src/arch/x86/isa/microops/mediaop.isa
@@ -666,4 +666,50 @@ let {{
}
FpDestReg.uqw = result;
'''
+
+ class Mmulf(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++) {
+ 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);
+ uint64_t resBits;
+
+ if (size == 4) {
+ floatInt arg1, arg2, res;
+ arg1.i = arg1Bits;
+ arg2.i = arg2Bits;
+ res.f = arg1.f * arg2.f;
+ resBits = res.i;
+ } else {
+ doubleInt arg1, arg2, res;
+ arg1.i = arg1Bits;
+ arg2.i = arg2Bits;
+ res.d = arg1.d * arg2.d;
+ resBits = res.i;
+ }
+
+ result = insertBits(result, hiIndex, loIndex, resBits);
+ }
+ FpDestReg.uqw = result;
+ '''
}};