mediaop.isa (6596:e60eaef99523) | mediaop.isa (6601:457527e517cc) |
---|---|
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 --- 1328 unchanged lines hidden (view full) --- 1337 if ((ext & 0x2) == 0 && arg1 == arg2 || 1338 (ext & 0x2) == 0x2 && arg1 > arg2) 1339 resBits = mask(sizeBits); 1340 1341 result = insertBits(result, hiIndex, loIndex, resBits); 1342 } 1343 FpDestReg.uqw = result; 1344 ''' | 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 --- 1328 unchanged lines hidden (view full) --- 1337 if ((ext & 0x2) == 0 && arg1 == arg2 || 1338 (ext & 0x2) == 0x2 && arg1 > arg2) 1339 resBits = mask(sizeBits); 1340 1341 result = insertBits(result, hiIndex, loIndex, resBits); 1342 } 1343 FpDestReg.uqw = result; 1344 ''' |
1345 1346 class Mcmpf2rf(MediaOp): 1347 def __init__(self, src1, src2,\ 1348 size = None, destSize = None, srcSize = None, ext = None): 1349 super(Mcmpf2rf, self).__init__("InstRegIndex(0)", src1,\ 1350 src2, size, destSize, srcSize, ext) 1351 code = ''' 1352 union floatInt 1353 { 1354 float f; 1355 uint32_t i; 1356 }; 1357 union doubleInt 1358 { 1359 double d; 1360 uint64_t i; 1361 }; 1362 1363 assert(srcSize == destSize); 1364 assert(srcSize == 4 || srcSize == 8); 1365 int size = srcSize; 1366 int sizeBits = size * 8; 1367 1368 double arg1, arg2; 1369 uint64_t arg1Bits = bits(FpSrcReg1.uqw, sizeBits - 1, 0); 1370 uint64_t arg2Bits = bits(FpSrcReg2.uqw, sizeBits - 1, 0); 1371 if (size == 4) { 1372 floatInt fi; 1373 fi.i = arg1Bits; 1374 arg1 = fi.f; 1375 fi.i = arg2Bits; 1376 arg2 = fi.f; 1377 } else { 1378 doubleInt di; 1379 di.i = arg1Bits; 1380 arg1 = di.d; 1381 di.i = arg2Bits; 1382 arg2 = di.d; 1383 } 1384 1385 // ZF PF CF 1386 // Unordered 1 1 1 1387 // Greater than 0 0 0 1388 // Less than 0 0 1 1389 // Equal 1 0 0 1390 // OF = SF = AF = 0 1391 ccFlagBits = ccFlagBits & ~(OFBit | SFBit | AFBit | 1392 ZFBit | PFBit | CFBit); 1393 if (isnan(arg1) || isnan(arg2)) 1394 ccFlagBits = ccFlagBits | (ZFBit | PFBit | CFBit); 1395 else if(arg1 < arg2) 1396 ccFlagBits = ccFlagBits | CFBit; 1397 else if(arg1 == arg2) 1398 ccFlagBits = ccFlagBits | ZFBit; 1399 ''' |
|
1345}}; | 1400}}; |