mediaop.isa (6601:457527e517cc) mediaop.isa (6603:b3333ef98685)
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

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

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
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

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

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 Mcmpf2r(MediaOp):
1347 code = '''
1348 union floatInt
1349 {
1350 float f;
1351 uint32_t i;
1352 };
1353 union doubleInt
1354 {
1355 double d;
1356 uint64_t i;
1357 };
1358
1359 assert(srcSize == destSize);
1360 int size = srcSize;
1361 int sizeBits = size * 8;
1362 int items = (ext & 0x8) ? 1: (sizeof(FloatRegBits) / size);
1363 uint64_t result = FpDestReg.uqw;
1364
1365 for (int i = 0; i < items; i++) {
1366 int hiIndex = (i + 1) * sizeBits - 1;
1367 int loIndex = (i + 0) * sizeBits;
1368 uint64_t arg1Bits = bits(FpSrcReg1.uqw, hiIndex, loIndex);
1369 uint64_t arg2Bits = bits(FpSrcReg2.uqw, hiIndex, loIndex);
1370 double arg1, arg2;
1371
1372 if (size == 4) {
1373 floatInt fi;
1374 fi.i = arg1Bits;
1375 arg1 = fi.f;
1376 fi.i = arg2Bits;
1377 arg2 = fi.f;
1378 } else {
1379 doubleInt di;
1380 di.i = arg1Bits;
1381 arg1 = di.d;
1382 di.i = arg2Bits;
1383 arg2 = di.d;
1384 }
1385
1386 uint64_t resBits = 0;
1387 bool nanop = isnan(arg1) || isnan(arg2);
1388 switch (ext & mask(3)) {
1389 case 0:
1390 if (arg1 == arg2 && !nanop)
1391 resBits = mask(sizeBits);
1392 break;
1393 case 1:
1394 if (arg1 < arg2 && !nanop)
1395 resBits = mask(sizeBits);
1396 break;
1397 case 2:
1398 if (arg1 <= arg2 && !nanop)
1399 resBits = mask(sizeBits);
1400 break;
1401 case 3:
1402 if (nanop)
1403 resBits = mask(sizeBits);
1404 break;
1405 case 4:
1406 if (arg1 != arg2 || nanop)
1407 resBits = mask(sizeBits);
1408 break;
1409 case 5:
1410 if (!(arg1 < arg2) || nanop)
1411 resBits = mask(sizeBits);
1412 break;
1413 case 6:
1414 if (!(arg1 <= arg2) || nanop)
1415 resBits = mask(sizeBits);
1416 break;
1417 case 7:
1418 if (!nanop)
1419 resBits = mask(sizeBits);
1420 break;
1421 };
1422
1423 result = insertBits(result, hiIndex, loIndex, resBits);
1424 }
1425 FpDestReg.uqw = result;
1426 '''
1427
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 {

--- 47 unchanged lines hidden ---
1428 class Mcmpf2rf(MediaOp):
1429 def __init__(self, src1, src2,\
1430 size = None, destSize = None, srcSize = None, ext = None):
1431 super(Mcmpf2rf, self).__init__("InstRegIndex(0)", src1,\
1432 src2, size, destSize, srcSize, ext)
1433 code = '''
1434 union floatInt
1435 {

--- 47 unchanged lines hidden ---