46 for (
int i = 0;
i < 16;
i++) {
50 result |= (value & 1 <<
i) << -shift;
52 result |= (value & 1 <<
i) >> shift;
62 int64_t svalue = (int64_t)value;
69 }
else if (svalue < (int64_t)
FIXED_SMIN[fmt]) {
78 }
else if (svalue < (int64_t)
FIXED_UMIN[fmt]) {
85 return (uint64_t)svalue;
92 int64_t svalue = (int64_t)value;
108 return (uint64_t)svalue;
115 uint64_t sign = uint64_t(1) << (signpos - 1);
116 uint64_t ones = ~(0
ULL);
119 value |= (ones << signpos);
121 value &= (ones >> (64 - signpos));
129 return value +=
ULL(1) << (lsbpos - 1);
143 for (
int i = 0;
i < nvals;
i++) {
144 svalue = (int64_t)a_values[
i];
149 }
else if (svalue < 0) {
150 a_values[
i] = uint64_t(0 - svalue);
165 int32_t sign, uint32_t *dspctl)
176 for (
int i = 0;
i < nvals;
i++)
207 for (
int i = 0;
i < nvals;
i++) {
211 a_values[
i] = (a_values[
i] + b_values[
i]) >> 1;
221 int32_t sign, uint32_t *dspctl)
232 for (
int i = 0;
i < nvals;
i++) {
262 for (
int i = 0;
i < nvals;
i++)
267 a_values[
i] = (a_values[
i] - b_values[
i]) >> 1;
277 int32_t sign, uint32_t *dspctl)
287 for (
int i = 0;
i < nvals;
i++)
290 a_values[
i] =
dspSaturate(a_values[
i] << sa, fmt, sign, &ouflag);
315 for (
int i = 0;
i < nvals;
i++)
316 a_values[
i] = a_values[
i] >> sa;
325 int32_t sign, uint32_t *dspctl)
335 for (
int i = 0;
i < nvals;
i++) {
339 a_values[
i] = a_values[
i] >>
sa;
349 int32_t round, uint32_t *dspctl)
362 for (
int i = 0;
i < nvals;
i++) {
367 temp = (int64_t)(a_values[
i] * b_values[
i]) >> (sa - 1);
401 for (
int i = 0;
i < nvals;
i++)
434 for (
int i = 0;
i < nvals;
i++)
439 for (
int i = 0; i < nvals; i++)
464 memset(c_values, 0,
sizeof(c_values));
471 for (
int i = 0;
i < nvals;
i++)
476 for (
int i = 0;
i < nvals;
i++)
493 int32_t infmt, int32_t outfmt, int32_t postsat, int32_t
mode,
506 for (
int i = 0;
i < nvals;
i++) {
509 if (a_values[nvals - 1 -
i] ==
FIXED_SMIN[infmt] &&
515 result += a_values[nvals - 1 -
i] * b_values[
i] << 1;
523 result += a_values[
i] * b_values[
i] << 1;
531 int signa =
bits(dspac, 63, 63);
532 int signb =
bits(result, 63, 63);
534 temp = dspac + result;
536 if (signa == signb &&
bits(temp, 63, 63) != signa) {
553 *dspctl =
insertBits(*dspctl, 16 + ac, 16 + ac, 1);
560 int32_t infmt, int32_t outfmt, int32_t postsat, int32_t
mode,
573 for (
int i = 0;
i < nvals;
i++) {
576 if (a_values[nvals - 1 -
i] ==
FIXED_SMIN[infmt] &&
581 result += a_values[nvals - 1 -
i] * b_values[
i] << 1;
590 result += a_values[
i] * b_values[
i] << 1;
598 int signa =
bits(dspac, 63, 63);
599 int signb =
bits(-result, 63, 63);
601 temp = dspac - result;
603 if (signa == signb &&
bits(temp, 63, 63) != signa) {
620 *dspctl =
insertBits(*dspctl, 16 + ac, 16 + ac, 1);
627 int32_t fmt, int32_t sign, int32_t
mode)
636 for (
int i = 0;
i < 2;
i++) {
639 dspac += a_values[nvals - 1 -
i] * b_values[nvals - 1 -
i];
642 dspac += a_values[nvals - 3 -
i] * b_values[nvals - 3 -
i];
645 dspac += a_values[nvals - 1 -
i] * b_values[
i];
655 int32_t fmt, int32_t sign, int32_t
mode)
664 for (
int i = 0;
i < 2;
i++) {
667 dspac -= a_values[nvals - 1 -
i] * b_values[nvals - 1 -
i];
670 dspac -= a_values[nvals - 3 -
i] * b_values[nvals - 3 -
i];
673 dspac -= a_values[nvals - 1 -
i] * b_values[
i];
683 int32_t fmt, int32_t
mode, int32_t saturate, uint32_t *dspctl)
694 for (
int i = 0;
i < nvals;
i++) {
697 temp = a_values[
i + 1] * b_values[
i + 1] << 1;
705 temp = a_values[
i] * b_values[
i] << 1;
719 *dspctl =
insertBits(*dspctl, 16 + ac, 16 + ac, 1);
734 dspac += a_values[1] * b_values[1] - a_values[0] * b_values[0];
741 int32_t fmt, uint32_t *dspctl)
746 int64_t temp[2] = {0, 0};
752 for (
int i = nvals - 1;
i > -1;
i--) {
753 temp[
i] = a_values[
i] * b_values[
i] << 1;
760 dspac += temp[1] - temp[0];
763 *dspctl =
insertBits(*dspctl, 16 + ac, 16 + ac, 1);
780 for (
int i = 0;
i < nvals;
i++) {
785 cc = (a_values[
i] == b_values[
i]);
788 cc = (a_values[
i] < b_values[
i]);
791 cc = (a_values[
i] <= b_values[
i]);
812 for (
int i = 0;
i < nvals;
i++) {
817 cc = (a_values[
i] == b_values[
i]);
820 cc = (a_values[
i] < b_values[
i]);
823 cc = (a_values[
i] <= b_values[
i]);
846 for (
int i = 0;
i < nvals;
i++) {
851 cc = (a_values[
i] == b_values[
i]);
854 cc = (a_values[
i] < b_values[
i]);
857 cc = (a_values[
i] <= b_values[
i]);
872 int32_t outsign, int32_t
mode)
890 for (
int i = 0;
i<noutvals;
i++) {
893 out_values[
i] = in_values[
i + (ninvals >> 1)] << sa;
896 out_values[
i] = in_values[
i] <<
sa;
899 out_values[
i] = in_values[(
i << 1) + 1] << sa;
902 out_values[
i] = in_values[
i << 1] <<
sa;
907 simdPack(out_values, &result, outfmt);
924 for (
int i = 0;
i<2;
i++) {
954 fmt + 1,
SIGNED, &ouflag);
956 fmt + 1,
SIGNED, &ouflag);
958 simdPack(r_values, &result, fmt + 1);
979 for (
int i = 0;
i < nvals;
i++) {
984 c_values[
i] = b_values[
i] >>
sa;
985 c_values[
i + 1] = a_values[
i] >>
sa;
989 simdPack(c_values, &result, fmt + 1);
1006 for (
int i = 0;
i < nvals;
i++) {
1008 if (
bits(*dspctl, condbit, condbit) == 1)
1009 c_values[
i] = a_values[
i];
1011 c_values[
i] = b_values[
i];
1030 c_values[0] = b_values[1];
1031 c_values[1] = a_values[0];
1040 int32_t saturate, uint32_t *dspctl)
1043 uint32_t ouflag = 0;
1046 sa =
bits(sa, 4, 0);
1052 if (dspac > 0 && temp < 0) {
1068 *dspctl =
insertBits(*dspctl, 23, 23, ouflag);
1073 result = (int32_t)temp;
1075 result = (int32_t)temp;
1087 pos =
bits(*dspctl, 5, 0);
1088 size =
bits(size, 4, 0);
1090 if (pos - (size + 1) >= -1) {
1091 result =
bits(dspac, pos, pos - size);
1107 pos =
bits(*dspctl, 5, 0);
1108 size =
bits(size, 4, 0);
1110 if (pos - (size + 1) >= -1) {
1111 result =
bits(dspac, pos, pos - size);
1113 if (pos - (size + 1) >= 0)
1114 *dspctl =
insertBits(*dspctl, 5, 0, pos - (size + 1));
1115 else if ((pos - (size + 1)) == -1)
1133 for (
int i = 0;
i < nvals;
i++)
1134 *reg |= (int32_t)
bits(values_ptr[
i], nbits - 1, 0) << nbits *
i;
1145 for (
int i = 0;
i < nvals;
i++) {
1146 uint64_t tmp = (uint64_t)
bits(reg, nbits * (
i + 1) - 1, nbits *
i);
1151 for (
int i = 0;
i < nvals;
i++) {
1153 (uint64_t)
bits(reg, nbits * (
i + 1) - 1, nbits *
i);
1188 return *dspctl & fmask;
const uint32_t SIMD_MAX_VALS
void dspCmp(int32_t a, int32_t b, int32_t fmt, int32_t sign, int32_t op, uint32_t *dspctl)
int32_t dspShll(int32_t a, uint32_t sa, int32_t fmt, int32_t saturate, int32_t sign, uint32_t *dspctl)
const uint32_t SIMD_LOG2N[SIMD_NUM_FMTS]
int64_t dspDpa(int64_t dspac, int32_t a, int32_t b, int32_t ac, int32_t fmt, int32_t sign, int32_t mode)
uint64_t dspSaturate(uint64_t value, int32_t fmt, int32_t sign, uint32_t *overflow)
int32_t dspPrecrSra(int32_t a, int32_t b, int32_t sa, int32_t fmt, int32_t round)
int32_t dspExtp(int64_t dspac, int32_t size, uint32_t *dspctl)
int32_t dspPick(int32_t a, int32_t b, int32_t fmt, uint32_t *dspctl)
const uint32_t SIMD_NVALS[SIMD_NUM_FMTS]
uint64_t checkOverflow(uint64_t value, int32_t fmt, int32_t sign, uint32_t *overflow)
int64_t dspMaq(int64_t dspac, int32_t a, int32_t b, int32_t ac, int32_t fmt, int32_t mode, int32_t saturate, uint32_t *dspctl)
static void overflow(double &c, const scfx_params ¶ms, bool &o_flag)
int64_t dspDpsq(int64_t dspac, int32_t a, int32_t b, int32_t ac, int32_t infmt, int32_t outfmt, int32_t postsat, int32_t mode, uint32_t *dspctl)
int32_t dspAbs(int32_t a, int32_t fmt, uint32_t *dspctl)
Overload hash function for BasicBlockRange type.
int32_t dspMulq(int32_t a, int32_t b, int32_t fmt, int32_t saturate, int32_t round, uint32_t *dspctl)
int32_t dspMul(int32_t a, int32_t b, int32_t fmt, int32_t saturate, uint32_t *dspctl)
int32_t dspExtpd(int64_t dspac, int32_t size, uint32_t *dspctl)
uint64_t signExtend(uint64_t value, int32_t signpos)
int32_t dspPrecrq(int32_t a, int32_t b, int32_t fmt, uint32_t *dspctl)
const uint32_t DSP_CTL_POS[DSP_NUM_FIELDS]
void simdUnpack(int32_t reg, uint64_t *values_ptr, int32_t fmt, int32_t sign)
const uint32_t DSP_CTL_MASK[DSP_NUM_FIELDS]
int32_t dspPrece(int32_t a, int32_t infmt, int32_t insign, int32_t outfmt, int32_t outsign, int32_t mode)
int32_t dspCmpg(int32_t a, int32_t b, int32_t fmt, int32_t sign, int32_t op)
void simdPack(uint64_t *values_ptr, int32_t *reg, int32_t fmt)
int32_t dspSub(int32_t a, int32_t b, int32_t fmt, int32_t saturate, int32_t sign, uint32_t *dspctl)
const uint64_t FIXED_UMAX[SIMD_NUM_FMTS]
T insertBits(T val, int first, int last, B bit_val)
Returns val with bits first to last set to the LSBs of bit_val.
int32_t dspAdd(int32_t a, int32_t b, int32_t fmt, int32_t saturate, int32_t sign, uint32_t *dspctl)
uint32_t readDSPControl(uint32_t *dspctl, uint32_t mask)
int32_t dspPrecrqu(int32_t a, int32_t b, uint32_t *dspctl)
int32_t dspShra(int32_t a, uint32_t sa, int32_t fmt, int32_t round, int32_t sign, uint32_t *dspctl)
int32_t dspCmpgd(int32_t a, int32_t b, int32_t fmt, int32_t sign, int32_t op, uint32_t *dspctl)
#define ULL(N)
uint64_t constant
void writeDSPControl(uint32_t *dspctl, uint32_t value, uint32_t mask)
int32_t dspShrl(int32_t a, uint32_t sa, int32_t fmt, int32_t sign)
const uint64_t FIXED_SMIN[SIMD_NUM_FMTS]
int64_t dspDpaq(int64_t dspac, int32_t a, int32_t b, int32_t ac, int32_t infmt, int32_t outfmt, int32_t postsat, int32_t mode, uint32_t *dspctl)
int32_t bitrev(int32_t value)
const uint32_t SIMD_NBITS[SIMD_NUM_FMTS]
int64_t dspMulsaq(int64_t dspac, int32_t a, int32_t b, int32_t ac, int32_t fmt, uint32_t *dspctl)
int32_t dspMuleq(int32_t a, int32_t b, int32_t mode, uint32_t *dspctl)
int32_t dspSubh(int32_t a, int32_t b, int32_t fmt, int32_t round, int32_t sign)
const uint64_t FIXED_UMIN[SIMD_NUM_FMTS]
uint64_t addHalfLsb(uint64_t value, int32_t lsbpos)
const uint64_t FIXED_SMAX[SIMD_NUM_FMTS]
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
int64_t dspMulsa(int64_t dspac, int32_t a, int32_t b, int32_t ac, int32_t fmt)
int32_t dspExtr(int64_t dspac, int32_t fmt, int32_t sa, int32_t round, int32_t saturate, uint32_t *dspctl)
int64_t dspDps(int64_t dspac, int32_t a, int32_t b, int32_t ac, int32_t fmt, int32_t sign, int32_t mode)
int32_t dspMuleu(int32_t a, int32_t b, int32_t mode, uint32_t *dspctl)
int32_t dspAddh(int32_t a, int32_t b, int32_t fmt, int32_t round, int32_t sign)
int32_t dspPack(int32_t a, int32_t b, int32_t fmt)