mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-05 10:47:26 +00:00
443 lines
12 KiB
C
443 lines
12 KiB
C
|
/*
|
||
|
* Copyright (c) 2003, 2007-14 Matteo Frigo
|
||
|
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 2 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
/* This file was automatically generated --- DO NOT EDIT */
|
||
|
/* Generated on Tue Sep 14 10:46:38 EDT 2021 */
|
||
|
|
||
|
#include "rdft/codelet-rdft.h"
|
||
|
|
||
|
#if defined(ARCH_PREFERS_FMA) || defined(ISA_EXTENSION_PREFERS_FMA)
|
||
|
|
||
|
/* Generated by: ../../../genfft/gen_hc2cdft.native -fma -compact -variables 4 -pipeline-latency 4 -twiddle-log3 -precompute-twiddles -n 8 -dit -name hc2cfdft2_8 -include rdft/scalar/hc2cf.h */
|
||
|
|
||
|
/*
|
||
|
* This function contains 90 FP additions, 66 FP multiplications,
|
||
|
* (or, 60 additions, 36 multiplications, 30 fused multiply/add),
|
||
|
* 45 stack variables, 2 constants, and 32 memory accesses
|
||
|
*/
|
||
|
#include "rdft/scalar/hc2cf.h"
|
||
|
|
||
|
static void hc2cfdft2_8(R *Rp, R *Ip, R *Rm, R *Im, const R *W, stride rs, INT mb, INT me, INT ms)
|
||
|
{
|
||
|
DK(KP707106781, +0.707106781186547524400844362104849039284835938);
|
||
|
DK(KP500000000, +0.500000000000000000000000000000000000000000000);
|
||
|
{
|
||
|
INT m;
|
||
|
for (m = mb, W = W + ((mb - 1) * 6); m < me; m = m + 1, Rp = Rp + ms, Ip = Ip + ms, Rm = Rm - ms, Im = Im - ms, W = W + 6, MAKE_VOLATILE_STRIDE(32, rs)) {
|
||
|
E T1, T2, Th, Tj, T4, T5, T6, Tk, TB, Tq, Tw, Tc, TM, TQ;
|
||
|
{
|
||
|
E T3, Ti, Tp, Tb, TL, TP;
|
||
|
T1 = W[0];
|
||
|
T2 = W[2];
|
||
|
T3 = T1 * T2;
|
||
|
Th = W[4];
|
||
|
Ti = T1 * Th;
|
||
|
Tj = W[5];
|
||
|
Tp = T1 * Tj;
|
||
|
T4 = W[1];
|
||
|
T5 = W[3];
|
||
|
Tb = T1 * T5;
|
||
|
T6 = FMA(T4, T5, T3);
|
||
|
Tk = FMA(T4, Tj, Ti);
|
||
|
TB = FMA(T4, T2, Tb);
|
||
|
Tq = FNMS(T4, Th, Tp);
|
||
|
Tw = FNMS(T4, T5, T3);
|
||
|
TL = T6 * Th;
|
||
|
TP = T6 * Tj;
|
||
|
Tc = FNMS(T4, T2, Tb);
|
||
|
TM = FMA(Tc, Tj, TL);
|
||
|
TQ = FNMS(Tc, Th, TP);
|
||
|
}
|
||
|
{
|
||
|
E TI, T1a, TY, T1u, TF, T1s, TS, T1c, Tg, T1n, T13, T1f, Tu, T1p, T17;
|
||
|
E T1h;
|
||
|
{
|
||
|
E TG, TH, TX, TT, TU, TV, TW, T1t;
|
||
|
TG = Ip[0];
|
||
|
TH = Im[0];
|
||
|
TX = TG + TH;
|
||
|
TT = Rm[0];
|
||
|
TU = Rp[0];
|
||
|
TV = TT - TU;
|
||
|
TI = TG - TH;
|
||
|
T1a = TU + TT;
|
||
|
TW = T1 * TV;
|
||
|
TY = FNMS(T4, TX, TW);
|
||
|
T1t = T4 * TV;
|
||
|
T1u = FMA(T1, TX, T1t);
|
||
|
}
|
||
|
{
|
||
|
E Tz, TR, TE, TN;
|
||
|
{
|
||
|
E Tx, Ty, TC, TD;
|
||
|
Tx = Ip[WS(rs, 2)];
|
||
|
Ty = Im[WS(rs, 2)];
|
||
|
Tz = Tx - Ty;
|
||
|
TR = Tx + Ty;
|
||
|
TC = Rp[WS(rs, 2)];
|
||
|
TD = Rm[WS(rs, 2)];
|
||
|
TE = TC + TD;
|
||
|
TN = TD - TC;
|
||
|
}
|
||
|
{
|
||
|
E TA, T1r, TO, T1b;
|
||
|
TA = Tw * Tz;
|
||
|
TF = FNMS(TB, TE, TA);
|
||
|
T1r = TQ * TN;
|
||
|
T1s = FMA(TM, TR, T1r);
|
||
|
TO = TM * TN;
|
||
|
TS = FNMS(TQ, TR, TO);
|
||
|
T1b = Tw * TE;
|
||
|
T1c = FMA(TB, Tz, T1b);
|
||
|
}
|
||
|
}
|
||
|
{
|
||
|
E T9, T12, Tf, T10;
|
||
|
{
|
||
|
E T7, T8, Td, Te;
|
||
|
T7 = Ip[WS(rs, 1)];
|
||
|
T8 = Im[WS(rs, 1)];
|
||
|
T9 = T7 - T8;
|
||
|
T12 = T7 + T8;
|
||
|
Td = Rp[WS(rs, 1)];
|
||
|
Te = Rm[WS(rs, 1)];
|
||
|
Tf = Td + Te;
|
||
|
T10 = Td - Te;
|
||
|
}
|
||
|
{
|
||
|
E Ta, T1m, T11, T1e;
|
||
|
Ta = T6 * T9;
|
||
|
Tg = FNMS(Tc, Tf, Ta);
|
||
|
T1m = T2 * T12;
|
||
|
T1n = FNMS(T5, T10, T1m);
|
||
|
T11 = T2 * T10;
|
||
|
T13 = FMA(T5, T12, T11);
|
||
|
T1e = T6 * Tf;
|
||
|
T1f = FMA(Tc, T9, T1e);
|
||
|
}
|
||
|
}
|
||
|
{
|
||
|
E Tn, T16, Tt, T14;
|
||
|
{
|
||
|
E Tl, Tm, Tr, Ts;
|
||
|
Tl = Ip[WS(rs, 3)];
|
||
|
Tm = Im[WS(rs, 3)];
|
||
|
Tn = Tl - Tm;
|
||
|
T16 = Tl + Tm;
|
||
|
Tr = Rp[WS(rs, 3)];
|
||
|
Ts = Rm[WS(rs, 3)];
|
||
|
Tt = Tr + Ts;
|
||
|
T14 = Tr - Ts;
|
||
|
}
|
||
|
{
|
||
|
E To, T1o, T15, T1g;
|
||
|
To = Tk * Tn;
|
||
|
Tu = FNMS(Tq, Tt, To);
|
||
|
T1o = Th * T16;
|
||
|
T1p = FNMS(Tj, T14, T1o);
|
||
|
T15 = Th * T14;
|
||
|
T17 = FMA(Tj, T16, T15);
|
||
|
T1g = Tk * Tt;
|
||
|
T1h = FMA(Tq, Tn, T1g);
|
||
|
}
|
||
|
}
|
||
|
{
|
||
|
E TK, T1l, T1w, T1y, T19, T1k, T1j, T1x;
|
||
|
{
|
||
|
E Tv, TJ, T1q, T1v;
|
||
|
Tv = Tg + Tu;
|
||
|
TJ = TF + TI;
|
||
|
TK = Tv + TJ;
|
||
|
T1l = TJ - Tv;
|
||
|
T1q = T1n + T1p;
|
||
|
T1v = T1s + T1u;
|
||
|
T1w = T1q - T1v;
|
||
|
T1y = T1q + T1v;
|
||
|
}
|
||
|
{
|
||
|
E TZ, T18, T1d, T1i;
|
||
|
TZ = TS + TY;
|
||
|
T18 = T13 + T17;
|
||
|
T19 = TZ - T18;
|
||
|
T1k = T18 + TZ;
|
||
|
T1d = T1a + T1c;
|
||
|
T1i = T1f + T1h;
|
||
|
T1j = T1d - T1i;
|
||
|
T1x = T1d + T1i;
|
||
|
}
|
||
|
Ip[0] = KP500000000 * (TK + T19);
|
||
|
Rp[0] = KP500000000 * (T1x + T1y);
|
||
|
Im[WS(rs, 3)] = KP500000000 * (T19 - TK);
|
||
|
Rm[WS(rs, 3)] = KP500000000 * (T1x - T1y);
|
||
|
Rm[WS(rs, 1)] = KP500000000 * (T1j - T1k);
|
||
|
Im[WS(rs, 1)] = KP500000000 * (T1w - T1l);
|
||
|
Rp[WS(rs, 2)] = KP500000000 * (T1j + T1k);
|
||
|
Ip[WS(rs, 2)] = KP500000000 * (T1l + T1w);
|
||
|
}
|
||
|
{
|
||
|
E T1B, T1N, T1L, T1R, T1E, T1O, T1H, T1P;
|
||
|
{
|
||
|
E T1z, T1A, T1J, T1K;
|
||
|
T1z = TI - TF;
|
||
|
T1A = T1f - T1h;
|
||
|
T1B = T1z - T1A;
|
||
|
T1N = T1A + T1z;
|
||
|
T1J = T1a - T1c;
|
||
|
T1K = Tg - Tu;
|
||
|
T1L = T1J - T1K;
|
||
|
T1R = T1J + T1K;
|
||
|
}
|
||
|
{
|
||
|
E T1C, T1D, T1F, T1G;
|
||
|
T1C = T1p - T1n;
|
||
|
T1D = T13 - T17;
|
||
|
T1E = T1C + T1D;
|
||
|
T1O = T1C - T1D;
|
||
|
T1F = TY - TS;
|
||
|
T1G = T1u - T1s;
|
||
|
T1H = T1F - T1G;
|
||
|
T1P = T1F + T1G;
|
||
|
}
|
||
|
{
|
||
|
E T1I, T1S, T1M, T1Q;
|
||
|
T1I = T1E + T1H;
|
||
|
Ip[WS(rs, 1)] = KP500000000 * (FMA(KP707106781, T1I, T1B));
|
||
|
Im[WS(rs, 2)] = -(KP500000000 * (FNMS(KP707106781, T1I, T1B)));
|
||
|
T1S = T1O + T1P;
|
||
|
Rm[WS(rs, 2)] = KP500000000 * (FNMS(KP707106781, T1S, T1R));
|
||
|
Rp[WS(rs, 1)] = KP500000000 * (FMA(KP707106781, T1S, T1R));
|
||
|
T1M = T1H - T1E;
|
||
|
Rm[0] = KP500000000 * (FNMS(KP707106781, T1M, T1L));
|
||
|
Rp[WS(rs, 3)] = KP500000000 * (FMA(KP707106781, T1M, T1L));
|
||
|
T1Q = T1O - T1P;
|
||
|
Ip[WS(rs, 3)] = KP500000000 * (FMA(KP707106781, T1Q, T1N));
|
||
|
Im[0] = -(KP500000000 * (FNMS(KP707106781, T1Q, T1N)));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static const tw_instr twinstr[] = {
|
||
|
{ TW_CEXP, 1, 1 },
|
||
|
{ TW_CEXP, 1, 3 },
|
||
|
{ TW_CEXP, 1, 7 },
|
||
|
{ TW_NEXT, 1, 0 }
|
||
|
};
|
||
|
|
||
|
static const hc2c_desc desc = { 8, "hc2cfdft2_8", twinstr, &GENUS, { 60, 36, 30, 0 } };
|
||
|
|
||
|
void X(codelet_hc2cfdft2_8) (planner *p) {
|
||
|
X(khc2c_register) (p, hc2cfdft2_8, &desc, HC2C_VIA_DFT);
|
||
|
}
|
||
|
#else
|
||
|
|
||
|
/* Generated by: ../../../genfft/gen_hc2cdft.native -compact -variables 4 -pipeline-latency 4 -twiddle-log3 -precompute-twiddles -n 8 -dit -name hc2cfdft2_8 -include rdft/scalar/hc2cf.h */
|
||
|
|
||
|
/*
|
||
|
* This function contains 90 FP additions, 56 FP multiplications,
|
||
|
* (or, 72 additions, 38 multiplications, 18 fused multiply/add),
|
||
|
* 51 stack variables, 2 constants, and 32 memory accesses
|
||
|
*/
|
||
|
#include "rdft/scalar/hc2cf.h"
|
||
|
|
||
|
static void hc2cfdft2_8(R *Rp, R *Ip, R *Rm, R *Im, const R *W, stride rs, INT mb, INT me, INT ms)
|
||
|
{
|
||
|
DK(KP353553390, +0.353553390593273762200422181052424519642417969);
|
||
|
DK(KP500000000, +0.500000000000000000000000000000000000000000000);
|
||
|
{
|
||
|
INT m;
|
||
|
for (m = mb, W = W + ((mb - 1) * 6); m < me; m = m + 1, Rp = Rp + ms, Ip = Ip + ms, Rm = Rm - ms, Im = Im - ms, W = W + 6, MAKE_VOLATILE_STRIDE(32, rs)) {
|
||
|
E T1, T4, T2, T5, Tu, Ty, T7, Td, Ti, Tj, Tk, TP, To, TN;
|
||
|
{
|
||
|
E T3, Tc, T6, Tb;
|
||
|
T1 = W[0];
|
||
|
T4 = W[1];
|
||
|
T2 = W[2];
|
||
|
T5 = W[3];
|
||
|
T3 = T1 * T2;
|
||
|
Tc = T4 * T2;
|
||
|
T6 = T4 * T5;
|
||
|
Tb = T1 * T5;
|
||
|
Tu = T3 - T6;
|
||
|
Ty = Tb + Tc;
|
||
|
T7 = T3 + T6;
|
||
|
Td = Tb - Tc;
|
||
|
Ti = W[4];
|
||
|
Tj = W[5];
|
||
|
Tk = FMA(T1, Ti, T4 * Tj);
|
||
|
TP = FNMS(Td, Ti, T7 * Tj);
|
||
|
To = FNMS(T4, Ti, T1 * Tj);
|
||
|
TN = FMA(T7, Ti, Td * Tj);
|
||
|
}
|
||
|
{
|
||
|
E TF, T11, TC, T12, T1d, T1e, T1q, TM, TR, T1p, Th, Ts, T15, T14, T1a;
|
||
|
E T1b, T1m, TV, TY, T1n;
|
||
|
{
|
||
|
E TD, TE, TL, TI, TJ, TK, Tx, TQ, TB, TO;
|
||
|
TD = Ip[0];
|
||
|
TE = Im[0];
|
||
|
TL = TD + TE;
|
||
|
TI = Rm[0];
|
||
|
TJ = Rp[0];
|
||
|
TK = TI - TJ;
|
||
|
{
|
||
|
E Tv, Tw, Tz, TA;
|
||
|
Tv = Ip[WS(rs, 2)];
|
||
|
Tw = Im[WS(rs, 2)];
|
||
|
Tx = Tv - Tw;
|
||
|
TQ = Tv + Tw;
|
||
|
Tz = Rp[WS(rs, 2)];
|
||
|
TA = Rm[WS(rs, 2)];
|
||
|
TB = Tz + TA;
|
||
|
TO = Tz - TA;
|
||
|
}
|
||
|
TF = TD - TE;
|
||
|
T11 = TJ + TI;
|
||
|
TC = FNMS(Ty, TB, Tu * Tx);
|
||
|
T12 = FMA(Tu, TB, Ty * Tx);
|
||
|
T1d = FNMS(TP, TO, TN * TQ);
|
||
|
T1e = FMA(T4, TK, T1 * TL);
|
||
|
T1q = T1e - T1d;
|
||
|
TM = FNMS(T4, TL, T1 * TK);
|
||
|
TR = FMA(TN, TO, TP * TQ);
|
||
|
T1p = TR + TM;
|
||
|
}
|
||
|
{
|
||
|
E Ta, TU, Tg, TT, Tn, TX, Tr, TW;
|
||
|
{
|
||
|
E T8, T9, Te, Tf;
|
||
|
T8 = Ip[WS(rs, 1)];
|
||
|
T9 = Im[WS(rs, 1)];
|
||
|
Ta = T8 - T9;
|
||
|
TU = T8 + T9;
|
||
|
Te = Rp[WS(rs, 1)];
|
||
|
Tf = Rm[WS(rs, 1)];
|
||
|
Tg = Te + Tf;
|
||
|
TT = Te - Tf;
|
||
|
}
|
||
|
{
|
||
|
E Tl, Tm, Tp, Tq;
|
||
|
Tl = Ip[WS(rs, 3)];
|
||
|
Tm = Im[WS(rs, 3)];
|
||
|
Tn = Tl - Tm;
|
||
|
TX = Tl + Tm;
|
||
|
Tp = Rp[WS(rs, 3)];
|
||
|
Tq = Rm[WS(rs, 3)];
|
||
|
Tr = Tp + Tq;
|
||
|
TW = Tp - Tq;
|
||
|
}
|
||
|
Th = FNMS(Td, Tg, T7 * Ta);
|
||
|
Ts = FNMS(To, Tr, Tk * Tn);
|
||
|
T15 = FMA(Tk, Tr, To * Tn);
|
||
|
T14 = FMA(T7, Tg, Td * Ta);
|
||
|
T1a = FNMS(T5, TT, T2 * TU);
|
||
|
T1b = FNMS(Tj, TW, Ti * TX);
|
||
|
T1m = T1b - T1a;
|
||
|
TV = FMA(T2, TT, T5 * TU);
|
||
|
TY = FMA(Ti, TW, Tj * TX);
|
||
|
T1n = TV - TY;
|
||
|
}
|
||
|
{
|
||
|
E T1l, T1x, T1A, T1C, T1s, T1w, T1v, T1B;
|
||
|
{
|
||
|
E T1j, T1k, T1y, T1z;
|
||
|
T1j = TF - TC;
|
||
|
T1k = T14 - T15;
|
||
|
T1l = KP500000000 * (T1j - T1k);
|
||
|
T1x = KP500000000 * (T1k + T1j);
|
||
|
T1y = T1m - T1n;
|
||
|
T1z = T1p + T1q;
|
||
|
T1A = KP353553390 * (T1y - T1z);
|
||
|
T1C = KP353553390 * (T1y + T1z);
|
||
|
}
|
||
|
{
|
||
|
E T1o, T1r, T1t, T1u;
|
||
|
T1o = T1m + T1n;
|
||
|
T1r = T1p - T1q;
|
||
|
T1s = KP353553390 * (T1o + T1r);
|
||
|
T1w = KP353553390 * (T1r - T1o);
|
||
|
T1t = T11 - T12;
|
||
|
T1u = Th - Ts;
|
||
|
T1v = KP500000000 * (T1t - T1u);
|
||
|
T1B = KP500000000 * (T1t + T1u);
|
||
|
}
|
||
|
Ip[WS(rs, 1)] = T1l + T1s;
|
||
|
Rp[WS(rs, 1)] = T1B + T1C;
|
||
|
Im[WS(rs, 2)] = T1s - T1l;
|
||
|
Rm[WS(rs, 2)] = T1B - T1C;
|
||
|
Rm[0] = T1v - T1w;
|
||
|
Im[0] = T1A - T1x;
|
||
|
Rp[WS(rs, 3)] = T1v + T1w;
|
||
|
Ip[WS(rs, 3)] = T1x + T1A;
|
||
|
}
|
||
|
{
|
||
|
E TH, T19, T1g, T1i, T10, T18, T17, T1h;
|
||
|
{
|
||
|
E Tt, TG, T1c, T1f;
|
||
|
Tt = Th + Ts;
|
||
|
TG = TC + TF;
|
||
|
TH = Tt + TG;
|
||
|
T19 = TG - Tt;
|
||
|
T1c = T1a + T1b;
|
||
|
T1f = T1d + T1e;
|
||
|
T1g = T1c - T1f;
|
||
|
T1i = T1c + T1f;
|
||
|
}
|
||
|
{
|
||
|
E TS, TZ, T13, T16;
|
||
|
TS = TM - TR;
|
||
|
TZ = TV + TY;
|
||
|
T10 = TS - TZ;
|
||
|
T18 = TZ + TS;
|
||
|
T13 = T11 + T12;
|
||
|
T16 = T14 + T15;
|
||
|
T17 = T13 - T16;
|
||
|
T1h = T13 + T16;
|
||
|
}
|
||
|
Ip[0] = KP500000000 * (TH + T10);
|
||
|
Rp[0] = KP500000000 * (T1h + T1i);
|
||
|
Im[WS(rs, 3)] = KP500000000 * (T10 - TH);
|
||
|
Rm[WS(rs, 3)] = KP500000000 * (T1h - T1i);
|
||
|
Rm[WS(rs, 1)] = KP500000000 * (T17 - T18);
|
||
|
Im[WS(rs, 1)] = KP500000000 * (T1g - T19);
|
||
|
Rp[WS(rs, 2)] = KP500000000 * (T17 + T18);
|
||
|
Ip[WS(rs, 2)] = KP500000000 * (T19 + T1g);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static const tw_instr twinstr[] = {
|
||
|
{ TW_CEXP, 1, 1 },
|
||
|
{ TW_CEXP, 1, 3 },
|
||
|
{ TW_CEXP, 1, 7 },
|
||
|
{ TW_NEXT, 1, 0 }
|
||
|
};
|
||
|
|
||
|
static const hc2c_desc desc = { 8, "hc2cfdft2_8", twinstr, &GENUS, { 72, 38, 18, 0 } };
|
||
|
|
||
|
void X(codelet_hc2cfdft2_8) (planner *p) {
|
||
|
X(khc2c_register) (p, hc2cfdft2_8, &desc, HC2C_VIA_DFT);
|
||
|
}
|
||
|
#endif
|