From: Luke Kenneth Casson Leighton Date: Mon, 28 Jun 2021 18:35:17 +0000 (+0100) Subject: add some notes into imdct_standalone.c X-Git-Tag: xlen-bcd~359 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5abd82f79c8f4da261307e788d9a3b73b2202142;p=openpower-isa.git add some notes into imdct_standalone.c --- diff --git a/media/audio/mp3/imdct36_standalone.c b/media/audio/mp3/imdct36_standalone.c index 04cc9838..fe275f21 100644 --- a/media/audio/mp3/imdct36_standalone.c +++ b/media/audio/mp3/imdct36_standalone.c @@ -86,11 +86,35 @@ void imdct36(float *out, float *buf, float *in, const float *win) float t0, t1, t2, t3, s0, s1, s2, s3; float tmp[18], *tmp1, *in1; + /* straight sv.fadds/mr for this one, should do a pascal's triangle + (prefix sum) + sv.fadds/mrr 10.v, 11.v, 10.v + */ for (i = 17; i >= 1; i--) in[i] += in[i-1]; + + /* this can use mrr mode with predicate 0b010101010101, + it will do the job, something like: + li r30, 0b010101010101 + setvl 16 + sv.fadds/mrr/m=r30 10.v, 12.v, 10.v + which will issue adds *in reverse* order + fadds 24, 26, 24 - not predicated (active) + fadds 23, 25, 23 - predicated (masked out) + fadds 22, 24, 22 - not predicated (active) + fadds 21, 23, 21 - predicated (masked out) + ... + should result in pascal's triangle for this one but + skipping every other element + */ for (i = 17; i >= 3; i -= 2) in[i] += in[i-2]; + /* all of these are independent, should be possible to do with + setvl 2. probably possible to break these down into some + sort of much smaller loop but the hand-coded nature of the + algorithm makes it difficult to spot the pattern. + */ for (j = 0; j < 2; j++) { tmp1 = tmp + j; in1 = in + j; @@ -122,6 +146,9 @@ void imdct36(float *out, float *buf, float *in, const float *win) tmp1[ 8] = t3 - t1 - t0; } + /* this can be done setvl 5 and with a predicate 0b01111 for the + items marked "if predicate" + */ i = 0; for (j = 0; j < 5; j++) { predicate = (j != 4);