From: Luke Kenneth Casson Leighton Date: Sat, 29 Apr 2023 16:30:08 +0000 (+0100) Subject: add code demonstrating 8 instructions replaced by one in ls016 twin-butterfly X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43da45cab9741fbac58918a9ab730aedcf7438bb;p=libreriscv.git add code demonstrating 8 instructions replaced by one in ls016 twin-butterfly --- diff --git a/openpower/sv/twin_butterfly.mdwn b/openpower/sv/twin_butterfly.mdwn index 7b71dca02..082dd79e2 100644 --- a/openpower/sv/twin_butterfly.mdwn +++ b/openpower/sv/twin_butterfly.mdwn @@ -51,6 +51,32 @@ run in accumulate mode, so in order to calculate the 2-coeff version one would just have to call the same instruction with different order a, b and a different constant c. +Example taken from libvpx +: + +``` + #include + #define ROUND_POWER_OF_TWO(value, n) \ + (((value) + (1 << ((n)-1))) >> (n)) + void twin_int(int16_t *t, int16_t x0, int16_t x1, int16_t cospi_16_64) { + t[0] = ROUND_POWER_OF_TWO((x0 + x1) * cospi_16_64, 14); + t[1] = ROUND_POWER_OF_TWO((x0 - x1) * cospi_16_64, 14); + } +``` + +8 instructions are required - replaced by just the one (maddsubrs): + +``` + add 9,5,4 + subf 5,5,4 + mullw 9,9,6 + mullw 5,5,6 + addi 9,9,8192 + addi 5,5,8192 + srawi 9,9,14 + srawi 5,5,14 +``` + ## Integer Butterfly Multiply Add/Sub FFT/DCT **Add the following to Book I Section 3.3.9.1**