summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-08-17 18:15:39 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-08-17 18:15:39 -0700
commitecc62e750e5f9a34c2c89570d2cd940b2dcf0035 (patch)
tree582b5bfdc964cf1ca246edbabb43583174562de2 /src/arch/x86
parent6457fb7003157dfe6c4c910b6dfae8824cab4356 (diff)
downloadgem5-ecc62e750e5f9a34c2c89570d2cd940b2dcf0035.tar.xz
X86: Implement an unpack microop.
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/isa/microops/mediaop.isa26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa
index a5371474e..7e03fcba3 100644
--- a/src/arch/x86/isa/microops/mediaop.isa
+++ b/src/arch/x86/isa/microops/mediaop.isa
@@ -308,4 +308,30 @@ let {{
FpDestReg.uqw =
insertBits(FpDestReg.uqw, destSize * 8 - 1, 0, srcReg1);
'''
+
+ class Unpack(MediaOp):
+ code = '''
+ assert(srcSize == destSize);
+ int size = destSize;
+ int items = (sizeof(FloatRegBits) / size) / 2;
+ int offset = sel ? items : 0;
+ uint64_t result = 0;
+ for (int i = 0; i < items; i++) {
+ uint64_t pickedLow =
+ bits(FpSrcReg1.uqw, (i + offset + 1) * 8 * size - 1,
+ (i + offset) * 8 * size);
+ result = insertBits(result,
+ (2 * i + 1) * 8 * size - 1,
+ (2 * i + 0) * 8 * size,
+ pickedLow);
+ uint64_t pickedHigh =
+ bits(FpSrcReg2.uqw, (i + offset + 1) * 8 * size - 1,
+ (i + offset) * 8 * size);
+ result = insertBits(result,
+ (2 * i + 2) * 8 * size - 1,
+ (2 * i + 1) * 8 * size,
+ pickedHigh);
+ }
+ FpDestReg.uqw = result;
+ '''
}};