mediaop.isa (6594:a5dbea7ba3f9) mediaop.isa (6596:e60eaef99523)
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

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

360 int loIndex = (i + 0) * sizeBits;
361 uint64_t arg1Bits = bits(FpSrcReg1.uqw, hiIndex, loIndex);
362 if (bits(FpSrcReg2.uqw, hiIndex))
363 result = insertBits(result, hiIndex, loIndex, arg1Bits);
364 }
365 FpDestReg.uqw = result;
366 '''
367
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

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

360 int loIndex = (i + 0) * sizeBits;
361 uint64_t arg1Bits = bits(FpSrcReg1.uqw, hiIndex, loIndex);
362 if (bits(FpSrcReg2.uqw, hiIndex))
363 result = insertBits(result, hiIndex, loIndex, arg1Bits);
364 }
365 FpDestReg.uqw = result;
366 '''
367
368 class shuffle(MediaOp):
369 code = '''
370 assert(srcSize == destSize);
371 int size = srcSize;
372 int sizeBits = size * 8;
373 int items = sizeof(FloatRegBits) / size;
374 int options;
375 int optionBits;
376 if (size == 8) {
377 options = 2;
378 optionBits = 1;
379 } else {
380 options = 4;
381 optionBits = 2;
382 }
383
384 uint64_t result = 0;
385 uint8_t sel = ext;
386
387 for (int i = 0; i < items; i++) {
388 uint64_t resBits;
389 uint8_t lsel = sel & mask(optionBits);
390 if (lsel * size >= sizeof(FloatRegBits)) {
391 lsel -= options / 2;
392 resBits = bits(FpSrcReg2.uqw,
393 (lsel + 1) * sizeBits - 1,
394 (lsel + 0) * sizeBits);
395 } else {
396 resBits = bits(FpSrcReg1.uqw,
397 (lsel + 1) * sizeBits - 1,
398 (lsel + 0) * sizeBits);
399 }
400
401 sel >>= optionBits;
402
403 int hiIndex = (i + 1) * sizeBits - 1;
404 int loIndex = (i + 0) * sizeBits;
405 result = insertBits(result, hiIndex, loIndex, resBits);
406 }
407 FpDestReg.uqw = result;
408 '''
409
368 class Unpack(MediaOp):
369 code = '''
370 assert(srcSize == destSize);
371 int size = destSize;
372 int items = (sizeof(FloatRegBits) / size) / 2;
373 int offset = ext ? items : 0;
374 uint64_t result = 0;
375 for (int i = 0; i < items; i++) {

--- 928 unchanged lines hidden ---
410 class Unpack(MediaOp):
411 code = '''
412 assert(srcSize == destSize);
413 int size = destSize;
414 int items = (sizeof(FloatRegBits) / size) / 2;
415 int offset = ext ? items : 0;
416 uint64_t result = 0;
417 for (int i = 0; i < items; i++) {

--- 928 unchanged lines hidden ---