summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-08-17 20:15:15 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-08-17 20:15:15 -0700
commita4437f8f14978e19cb529fadd77fc3563a0ce5c4 (patch)
tree21cf7c8772149b26954a2f1341eb871f88aab930 /src
parentc40698e31514fae76d046b3ef94f67dbb61cf688 (diff)
downloadgem5-a4437f8f14978e19cb529fadd77fc3563a0ce5c4.tar.xz
X86: Implement an integer media subtract microop.
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/isa/microops/mediaop.isa39
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 b07b57ce9..12dfa026c 100644
--- a/src/arch/x86/isa/microops/mediaop.isa
+++ b/src/arch/x86/isa/microops/mediaop.isa
@@ -870,6 +870,45 @@ let {{
FpDestReg.uqw = result;
'''
+ class Msubi(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);
+ uint64_t arg2Bits = bits(FpSrcReg2.uqw, hiIndex, loIndex);
+ uint64_t resBits = arg1Bits - arg2Bits;
+
+ if (ext & 0x2) {
+ if (arg2Bits > arg1Bits) {
+ resBits = 0;
+ } else if (!findCarry(sizeBits, resBits,
+ arg1Bits, ~arg2Bits)) {
+ resBits = mask(sizeBits);
+ }
+ } else if (ext & 0x4) {
+ int arg1Sign = bits(arg1Bits, sizeBits - 1);
+ int arg2Sign = !bits(arg2Bits, sizeBits - 1);
+ int resSign = bits(resBits, sizeBits - 1);
+ if ((arg1Sign == arg2Sign) && (arg1Sign != resSign)) {
+ if (resSign == 0)
+ resBits = (1 << (sizeBits - 1));
+ else
+ resBits = mask(sizeBits - 1);
+ }
+ }
+
+ result = insertBits(result, hiIndex, loIndex, resBits);
+ }
+ FpDestReg.uqw = result;
+ '''
+
class Mmuli(MediaOp):
code = '''
int srcBits = srcSize * 8;