45 for (
int i = 0;
i < 16;
i++) {
49 result |= (value & 1 <<
i) << -
shift;
51 result |= (value & 1 <<
i) >>
shift;
61 int64_t svalue = (int64_t)value;
68 }
else if (svalue < (int64_t)
FIXED_SMIN[fmt]) {
77 }
else if (svalue < (int64_t)
FIXED_UMIN[fmt]) {
84 return (uint64_t)svalue;
91 int64_t svalue = (int64_t)value;
107 return (uint64_t)svalue;
114 uint64_t sign = uint64_t(1) << (signpos - 1);
115 uint64_t ones = ~(0
ULL);
118 value |= (ones << signpos);
120 value &= (ones >> (64 - signpos));
128 return value +=
ULL(1) << (lsbpos - 1);
142 for (
int i = 0;
i < nvals;
i++) {
143 svalue = (int64_t)a_values[
i];
148 }
else if (svalue < 0) {
149 a_values[
i] = uint64_t(0 - svalue);
164 int32_t sign, uint32_t *dspctl)
175 for (
int i = 0;
i < nvals;
i++)
206 for (
int i = 0;
i < nvals;
i++) {
210 a_values[
i] = (a_values[
i] + b_values[
i]) >> 1;
220 int32_t sign, uint32_t *dspctl)
231 for (
int i = 0;
i < nvals;
i++) {
261 for (
int i = 0;
i < nvals;
i++)
266 a_values[
i] = (a_values[
i] - b_values[
i]) >> 1;
276 int32_t sign, uint32_t *dspctl)
286 for (
int i = 0;
i < nvals;
i++)
314 for (
int i = 0;
i < nvals;
i++)
315 a_values[
i] = a_values[
i] >>
sa;
324 int32_t sign, uint32_t *dspctl)
334 for (
int i = 0;
i < nvals;
i++) {
338 a_values[
i] = a_values[
i] >>
sa;
348 int32_t round, uint32_t *dspctl)
361 for (
int i = 0;
i < nvals;
i++) {
366 temp = (int64_t)(a_values[
i] * b_values[
i]) >> (
sa - 1);
400 for (
int i = 0;
i < nvals;
i++)
433 for (
int i = 0;
i < nvals;
i++)
438 for (
int i = 0;
i < nvals;
i++)
463 memset(c_values, 0,
sizeof(c_values));
470 for (
int i = 0;
i < nvals;
i++)
475 for (
int i = 0;
i < nvals;
i++)
492 int32_t infmt, int32_t outfmt, int32_t postsat, int32_t
mode,
505 for (
int i = 0;
i < nvals;
i++) {
508 if (a_values[nvals - 1 -
i] ==
FIXED_SMIN[infmt] &&
514 result += a_values[nvals - 1 -
i] * b_values[
i] << 1;
522 result += a_values[
i] * b_values[
i] << 1;
530 int signa =
bits(dspac, 63, 63);
531 int signb =
bits(result, 63, 63);
533 temp = dspac + result;
535 if (signa == signb &&
bits(temp, 63, 63) != signa) {
559 int32_t infmt, int32_t outfmt, int32_t postsat, int32_t
mode,
572 for (
int i = 0;
i < nvals;
i++) {
575 if (a_values[nvals - 1 -
i] ==
FIXED_SMIN[infmt] &&
580 result += a_values[nvals - 1 -
i] * b_values[
i] << 1;
589 result += a_values[
i] * b_values[
i] << 1;
597 int signa =
bits(dspac, 63, 63);
598 int signb =
bits(-result, 63, 63);
600 temp = dspac - result;
602 if (signa == signb &&
bits(temp, 63, 63) != signa) {
626 int32_t fmt, int32_t sign, int32_t
mode)
635 for (
int i = 0;
i < 2;
i++) {
638 dspac += a_values[nvals - 1 -
i] * b_values[nvals - 1 -
i];
641 dspac += a_values[nvals - 3 -
i] * b_values[nvals - 3 -
i];
644 dspac += a_values[nvals - 1 -
i] * b_values[
i];
654 int32_t fmt, int32_t sign, int32_t
mode)
663 for (
int i = 0;
i < 2;
i++) {
666 dspac -= a_values[nvals - 1 -
i] * b_values[nvals - 1 -
i];
669 dspac -= a_values[nvals - 3 -
i] * b_values[nvals - 3 -
i];
672 dspac -= a_values[nvals - 1 -
i] * b_values[
i];
682 int32_t fmt, int32_t
mode, int32_t saturate, uint32_t *dspctl)
693 for (
int i = 0;
i < nvals;
i++) {
696 temp = a_values[
i + 1] * b_values[
i + 1] << 1;
704 temp = a_values[
i] * b_values[
i] << 1;
733 dspac += a_values[1] * b_values[1] - a_values[0] * b_values[0];
740 int32_t fmt, uint32_t *dspctl)
745 int64_t temp[2] = {0, 0};
751 for (
int i = nvals - 1;
i > -1;
i--) {
752 temp[
i] = a_values[
i] * b_values[
i] << 1;
759 dspac += temp[1] - temp[0];
779 for (
int i = 0;
i < nvals;
i++) {
784 cc = (a_values[
i] == b_values[
i]);
787 cc = (a_values[
i] < b_values[
i]);
790 cc = (a_values[
i] <= b_values[
i]);
811 for (
int i = 0;
i < nvals;
i++) {
816 cc = (a_values[
i] == b_values[
i]);
819 cc = (a_values[
i] < b_values[
i]);
822 cc = (a_values[
i] <= b_values[
i]);
845 for (
int i = 0;
i < nvals;
i++) {
850 cc = (a_values[
i] == b_values[
i]);
853 cc = (a_values[
i] < b_values[
i]);
856 cc = (a_values[
i] <= b_values[
i]);
871 int32_t outsign, int32_t
mode)
889 for (
int i = 0;
i<noutvals;
i++) {
892 out_values[
i] = in_values[
i + (ninvals >> 1)] <<
sa;
895 out_values[
i] = in_values[
i] <<
sa;
898 out_values[
i] = in_values[(
i << 1) + 1] <<
sa;
901 out_values[
i] = in_values[
i << 1] <<
sa;
906 simdPack(out_values, &result, outfmt);
923 for (
int i = 0;
i<2;
i++) {
953 fmt + 1,
SIGNED, &ouflag);
955 fmt + 1,
SIGNED, &ouflag);
957 simdPack(r_values, &result, fmt + 1);
978 for (
int i = 0;
i < nvals;
i++) {
983 c_values[
i] = b_values[
i] >>
sa;
984 c_values[
i + 1] = a_values[
i] >>
sa;
988 simdPack(c_values, &result, fmt + 1);
1005 for (
int i = 0;
i < nvals;
i++) {
1007 if (
bits(*dspctl, condbit, condbit) == 1)
1008 c_values[
i] = a_values[
i];
1010 c_values[
i] = b_values[
i];
1029 c_values[0] = b_values[1];
1030 c_values[1] = a_values[0];
1039 int32_t saturate, uint32_t *dspctl)
1042 uint32_t ouflag = 0;
1051 if (dspac > 0 && temp < 0) {
1067 *dspctl =
insertBits(*dspctl, 23, 23, ouflag);
1072 result = (int32_t)temp;
1074 result = (int32_t)temp;
1086 pos =
bits(*dspctl, 5, 0);
1087 size =
bits(size, 4, 0);
1089 if (pos - (size + 1) >= -1) {
1090 result =
bits(dspac, pos, pos - size);
1106 pos =
bits(*dspctl, 5, 0);
1107 size =
bits(size, 4, 0);
1109 if (pos - (size + 1) >= -1) {
1110 result =
bits(dspac, pos, pos - size);
1112 if (pos - (size + 1) >= 0)
1113 *dspctl =
insertBits(*dspctl, 5, 0, pos - (size + 1));
1114 else if ((pos - (size + 1)) == -1)
1132 for (
int i = 0;
i < nvals;
i++)
1133 *
reg |= (int32_t)
bits(values_ptr[
i], nbits - 1, 0) << nbits *
i;
1144 for (
int i = 0;
i < nvals;
i++) {
1145 uint64_t tmp = (uint64_t)
bits(
reg, nbits * (
i + 1) - 1, nbits *
i);
1150 for (
int i = 0;
i < nvals;
i++) {
1152 (uint64_t)
bits(
reg, nbits * (
i + 1) - 1, nbits *
i);
1187 return *dspctl & fmask;