mediaop.isa (6568:a34aae12095c) mediaop.isa (6570:d7907eaf7419)
1/// Copyright (c) 2009 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 745 unchanged lines hidden (view full) ---

754 resBits = res.i;
755 }
756
757 result = insertBits(result, hiIndex, loIndex, resBits);
758 }
759 FpDestReg.uqw = result;
760 '''
761
1/// Copyright (c) 2009 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 745 unchanged lines hidden (view full) ---

754 resBits = res.i;
755 }
756
757 result = insertBits(result, hiIndex, loIndex, resBits);
758 }
759 FpDestReg.uqw = result;
760 '''
761
762 class Maddi(MediaOp):
763 code = '''
764 assert(srcSize == destSize);
765 int size = srcSize;
766 int sizeBits = size * 8;
767 int items = (ext & 0x1) ? 1: (sizeof(FloatRegBits) / size);
768 uint64_t result = FpDestReg.uqw;
769
770 for (int i = 0; i < items; i++) {
771 int hiIndex = (i + 1) * sizeBits - 1;
772 int loIndex = (i + 0) * sizeBits;
773 uint64_t arg1Bits = bits(FpSrcReg1.uqw, hiIndex, loIndex);
774 uint64_t arg2Bits = bits(FpSrcReg2.uqw, hiIndex, loIndex);
775 uint64_t resBits = arg1Bits + arg2Bits;
776
777 if (ext & 0x2) {
778 if (findCarry(sizeBits, resBits, arg1Bits, arg2Bits))
779 resBits = mask(sizeBits);
780 } else if (ext & 0x4) {
781 int arg1Sign = bits(arg1Bits, sizeBits - 1);
782 int arg2Sign = bits(arg2Bits, sizeBits - 1);
783 int resSign = bits(resBits, sizeBits - 1);
784 if ((arg1Sign == arg2Sign) && (arg1Sign != resSign)) {
785 if (resSign == 0)
786 resBits = (1 << (sizeBits - 1));
787 else
788 resBits = mask(sizeBits - 1);
789 }
790 }
791
792 result = insertBits(result, hiIndex, loIndex, resBits);
793 }
794 FpDestReg.uqw = result;
795 '''
796
762 class Cvti2f(MediaOp):
763 def __init__(self, dest, src, \
764 size = None, destSize = None, srcSize = None, ext = None):
765 super(Cvti2f, self).__init__(dest, src,\
766 "InstRegIndex(0)", size, destSize, srcSize, ext)
767 code = '''
768 union floatInt
769 {

--- 159 unchanged lines hidden ---
797 class Cvti2f(MediaOp):
798 def __init__(self, dest, src, \
799 size = None, destSize = None, srcSize = None, ext = None):
800 super(Cvti2f, self).__init__(dest, src,\
801 "InstRegIndex(0)", size, destSize, srcSize, ext)
802 code = '''
803 union floatInt
804 {

--- 159 unchanged lines hidden ---