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++)
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) {
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) {
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;
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];
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;
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;