DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 1 | ; |
DRC | 72130be | 2014-05-09 20:14:26 +0000 | [diff] [blame] | 2 | ; jfdctflt.asm - floating-point FDCT (64-bit SSE) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 3 | ; |
| 4 | ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
DRC | 123f725 | 2016-05-24 10:23:56 -0500 | [diff] [blame] | 5 | ; Copyright (C) 2009, D. R. Commander. |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 6 | ; |
DRC | 123f725 | 2016-05-24 10:23:56 -0500 | [diff] [blame] | 7 | ; Based on the x86 SIMD extension for IJG JPEG library |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 8 | ; Copyright (C) 1999-2006, MIYASAKA Masaru. |
| 9 | ; For conditions of distribution and use, see copyright notice in jsimdext.inc |
| 10 | ; |
| 11 | ; This file should be assembled with NASM (Netwide Assembler), |
| 12 | ; can *not* be assembled with Microsoft's MASM or any compatible |
| 13 | ; assembler (including Borland's Turbo Assembler). |
| 14 | ; NASM is available from http://nasm.sourceforge.net/ or |
| 15 | ; http://sourceforge.net/project/showfiles.php?group_id=6208 |
| 16 | ; |
| 17 | ; This file contains a floating-point implementation of the forward DCT |
| 18 | ; (Discrete Cosine Transform). The following code is based directly on |
| 19 | ; the IJG's original jfdctflt.c; see the jfdctflt.c for more details. |
| 20 | ; |
| 21 | ; [TAB8] |
| 22 | |
| 23 | %include "jsimdext.inc" |
| 24 | %include "jdct.inc" |
| 25 | |
| 26 | ; -------------------------------------------------------------------------- |
| 27 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 28 | %macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) |
| 29 | shufps %1,%2,0x44 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 30 | %endmacro |
| 31 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 32 | %macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) |
| 33 | shufps %1,%2,0xEE |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 34 | %endmacro |
| 35 | |
| 36 | ; -------------------------------------------------------------------------- |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 37 | SECTION SEG_CONST |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 38 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 39 | alignz 16 |
Michael Jurka | a9e2849 | 2016-08-08 19:14:00 -0700 | [diff] [blame^] | 40 | global EXTN(jconst_fdct_float_sse) PRIVATE |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 41 | |
| 42 | EXTN(jconst_fdct_float_sse): |
| 43 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 44 | PD_0_382 times 4 dd 0.382683432365089771728460 |
| 45 | PD_0_707 times 4 dd 0.707106781186547524400844 |
| 46 | PD_0_541 times 4 dd 0.541196100146196984399723 |
| 47 | PD_1_306 times 4 dd 1.306562964876376527856643 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 48 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 49 | alignz 16 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 50 | |
| 51 | ; -------------------------------------------------------------------------- |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 52 | SECTION SEG_TEXT |
| 53 | BITS 64 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 54 | ; |
| 55 | ; Perform the forward DCT on one block of samples. |
| 56 | ; |
| 57 | ; GLOBAL(void) |
DRC | bd49803 | 2016-02-19 08:53:33 -0600 | [diff] [blame] | 58 | ; jsimd_fdct_float_sse (FAST_FLOAT *data) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 59 | ; |
| 60 | |
DRC | bd49803 | 2016-02-19 08:53:33 -0600 | [diff] [blame] | 61 | ; r10 = FAST_FLOAT *data |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 62 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 63 | %define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] |
| 64 | %define WK_NUM 2 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 65 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 66 | align 16 |
Michael Jurka | a9e2849 | 2016-08-08 19:14:00 -0700 | [diff] [blame^] | 67 | global EXTN(jsimd_fdct_float_sse) PRIVATE |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 68 | |
| 69 | EXTN(jsimd_fdct_float_sse): |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 70 | push rbp |
| 71 | mov rax,rsp ; rax = original rbp |
| 72 | sub rsp, byte 4 |
| 73 | and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits |
| 74 | mov [rsp],rax |
| 75 | mov rbp,rsp ; rbp = aligned rbp |
| 76 | lea rsp, [wk(0)] |
| 77 | collect_args |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 78 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 79 | ; ---- Pass 1: process rows. |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 80 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 81 | mov rdx, r10 ; (FAST_FLOAT *) |
| 82 | mov rcx, DCTSIZE/4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 83 | .rowloop: |
| 84 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 85 | movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] |
| 86 | movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] |
| 87 | movaps xmm2, XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)] |
| 88 | movaps xmm3, XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)] |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 89 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 90 | ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) |
| 91 | ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 92 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 93 | movaps xmm4,xmm0 ; transpose coefficients(phase 1) |
| 94 | unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) |
| 95 | unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) |
| 96 | movaps xmm5,xmm2 ; transpose coefficients(phase 1) |
| 97 | unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) |
| 98 | unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 99 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 100 | movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] |
| 101 | movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] |
| 102 | movaps xmm1, XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)] |
| 103 | movaps xmm3, XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)] |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 104 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 105 | ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) |
| 106 | ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 107 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 108 | movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) |
| 109 | movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 110 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 111 | movaps xmm4,xmm6 ; transpose coefficients(phase 1) |
| 112 | unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) |
| 113 | unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) |
| 114 | movaps xmm2,xmm1 ; transpose coefficients(phase 1) |
| 115 | unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) |
| 116 | unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 117 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 118 | movaps xmm7,xmm6 ; transpose coefficients(phase 2) |
| 119 | unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 |
| 120 | unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 |
| 121 | movaps xmm3,xmm2 ; transpose coefficients(phase 2) |
| 122 | unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 |
| 123 | unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 124 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 125 | movaps xmm0,xmm7 |
| 126 | movaps xmm5,xmm6 |
| 127 | subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 |
| 128 | subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 |
| 129 | addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 |
| 130 | addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 131 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 132 | movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) |
| 133 | movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) |
| 134 | movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 |
| 135 | movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 136 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 137 | movaps xmm7,xmm4 ; transpose coefficients(phase 2) |
| 138 | unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 |
| 139 | unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 |
| 140 | movaps xmm6,xmm1 ; transpose coefficients(phase 2) |
| 141 | unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 |
| 142 | unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 143 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 144 | movaps xmm2,xmm7 |
| 145 | movaps xmm3,xmm4 |
| 146 | addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 |
| 147 | addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 |
| 148 | subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 |
| 149 | subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 150 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 151 | ; -- Even part |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 152 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 153 | movaps xmm1,xmm5 |
| 154 | movaps xmm6,xmm0 |
| 155 | subps xmm5,xmm7 ; xmm5=tmp13 |
| 156 | subps xmm0,xmm4 ; xmm0=tmp12 |
| 157 | addps xmm1,xmm7 ; xmm1=tmp10 |
| 158 | addps xmm6,xmm4 ; xmm6=tmp11 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 159 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 160 | addps xmm0,xmm5 |
| 161 | mulps xmm0,[rel PD_0_707] ; xmm0=z1 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 162 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 163 | movaps xmm7,xmm1 |
| 164 | movaps xmm4,xmm5 |
| 165 | subps xmm1,xmm6 ; xmm1=data4 |
| 166 | subps xmm5,xmm0 ; xmm5=data6 |
| 167 | addps xmm7,xmm6 ; xmm7=data0 |
| 168 | addps xmm4,xmm0 ; xmm4=data2 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 169 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 170 | movaps XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)], xmm1 |
| 171 | movaps XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 |
| 172 | movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 |
| 173 | movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 174 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 175 | ; -- Odd part |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 176 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 177 | movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 |
| 178 | movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 179 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 180 | addps xmm2,xmm3 ; xmm2=tmp10 |
| 181 | addps xmm3,xmm6 ; xmm3=tmp11 |
| 182 | addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 183 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 184 | mulps xmm3,[rel PD_0_707] ; xmm3=z3 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 185 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 186 | movaps xmm1,xmm2 ; xmm1=tmp10 |
| 187 | subps xmm2,xmm6 |
| 188 | mulps xmm2,[rel PD_0_382] ; xmm2=z5 |
| 189 | mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) |
| 190 | mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) |
| 191 | addps xmm1,xmm2 ; xmm1=z2 |
| 192 | addps xmm6,xmm2 ; xmm6=z4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 193 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 194 | movaps xmm5,xmm0 |
| 195 | subps xmm0,xmm3 ; xmm0=z13 |
| 196 | addps xmm5,xmm3 ; xmm5=z11 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 197 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 198 | movaps xmm7,xmm0 |
| 199 | movaps xmm4,xmm5 |
| 200 | subps xmm0,xmm1 ; xmm0=data3 |
| 201 | subps xmm5,xmm6 ; xmm5=data7 |
| 202 | addps xmm7,xmm1 ; xmm7=data5 |
| 203 | addps xmm4,xmm6 ; xmm4=data1 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 204 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 205 | movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 |
| 206 | movaps XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 |
| 207 | movaps XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)], xmm7 |
| 208 | movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 209 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 210 | add rdx, 4*DCTSIZE*SIZEOF_FAST_FLOAT |
| 211 | dec rcx |
| 212 | jnz near .rowloop |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 213 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 214 | ; ---- Pass 2: process columns. |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 215 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 216 | mov rdx, r10 ; (FAST_FLOAT *) |
| 217 | mov rcx, DCTSIZE/4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 218 | .columnloop: |
| 219 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 220 | movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] |
| 221 | movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] |
| 222 | movaps xmm2, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)] |
| 223 | movaps xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)] |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 224 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 225 | ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) |
| 226 | ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 227 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 228 | movaps xmm4,xmm0 ; transpose coefficients(phase 1) |
| 229 | unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) |
| 230 | unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) |
| 231 | movaps xmm5,xmm2 ; transpose coefficients(phase 1) |
| 232 | unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) |
| 233 | unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 234 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 235 | movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] |
| 236 | movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] |
| 237 | movaps xmm1, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)] |
| 238 | movaps xmm3, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)] |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 239 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 240 | ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) |
| 241 | ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 242 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 243 | movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) |
| 244 | movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 245 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 246 | movaps xmm4,xmm6 ; transpose coefficients(phase 1) |
| 247 | unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) |
| 248 | unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) |
| 249 | movaps xmm2,xmm1 ; transpose coefficients(phase 1) |
| 250 | unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) |
| 251 | unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 252 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 253 | movaps xmm7,xmm6 ; transpose coefficients(phase 2) |
| 254 | unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 |
| 255 | unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 |
| 256 | movaps xmm3,xmm2 ; transpose coefficients(phase 2) |
| 257 | unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 |
| 258 | unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 259 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 260 | movaps xmm0,xmm7 |
| 261 | movaps xmm5,xmm6 |
| 262 | subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 |
| 263 | subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 |
| 264 | addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 |
| 265 | addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 266 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 267 | movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) |
| 268 | movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) |
| 269 | movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 |
| 270 | movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 271 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 272 | movaps xmm7,xmm4 ; transpose coefficients(phase 2) |
| 273 | unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 |
| 274 | unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 |
| 275 | movaps xmm6,xmm1 ; transpose coefficients(phase 2) |
| 276 | unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 |
| 277 | unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 278 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 279 | movaps xmm2,xmm7 |
| 280 | movaps xmm3,xmm4 |
| 281 | addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 |
| 282 | addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 |
| 283 | subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 |
| 284 | subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 285 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 286 | ; -- Even part |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 287 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 288 | movaps xmm1,xmm5 |
| 289 | movaps xmm6,xmm0 |
| 290 | subps xmm5,xmm7 ; xmm5=tmp13 |
| 291 | subps xmm0,xmm4 ; xmm0=tmp12 |
| 292 | addps xmm1,xmm7 ; xmm1=tmp10 |
| 293 | addps xmm6,xmm4 ; xmm6=tmp11 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 294 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 295 | addps xmm0,xmm5 |
| 296 | mulps xmm0,[rel PD_0_707] ; xmm0=z1 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 297 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 298 | movaps xmm7,xmm1 |
| 299 | movaps xmm4,xmm5 |
| 300 | subps xmm1,xmm6 ; xmm1=data4 |
| 301 | subps xmm5,xmm0 ; xmm5=data6 |
| 302 | addps xmm7,xmm6 ; xmm7=data0 |
| 303 | addps xmm4,xmm0 ; xmm4=data2 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 304 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 305 | movaps XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)], xmm1 |
| 306 | movaps XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 |
| 307 | movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 |
| 308 | movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 309 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 310 | ; -- Odd part |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 311 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 312 | movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 |
| 313 | movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 314 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 315 | addps xmm2,xmm3 ; xmm2=tmp10 |
| 316 | addps xmm3,xmm6 ; xmm3=tmp11 |
| 317 | addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 318 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 319 | mulps xmm3,[rel PD_0_707] ; xmm3=z3 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 320 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 321 | movaps xmm1,xmm2 ; xmm1=tmp10 |
| 322 | subps xmm2,xmm6 |
| 323 | mulps xmm2,[rel PD_0_382] ; xmm2=z5 |
| 324 | mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) |
| 325 | mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) |
| 326 | addps xmm1,xmm2 ; xmm1=z2 |
| 327 | addps xmm6,xmm2 ; xmm6=z4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 328 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 329 | movaps xmm5,xmm0 |
| 330 | subps xmm0,xmm3 ; xmm0=z13 |
| 331 | addps xmm5,xmm3 ; xmm5=z11 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 332 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 333 | movaps xmm7,xmm0 |
| 334 | movaps xmm4,xmm5 |
| 335 | subps xmm0,xmm1 ; xmm0=data3 |
| 336 | subps xmm5,xmm6 ; xmm5=data7 |
| 337 | addps xmm7,xmm1 ; xmm7=data5 |
| 338 | addps xmm4,xmm6 ; xmm4=data1 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 339 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 340 | movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 |
| 341 | movaps XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 |
| 342 | movaps XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 |
| 343 | movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 344 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 345 | add rdx, byte 4*SIZEOF_FAST_FLOAT |
| 346 | dec rcx |
| 347 | jnz near .columnloop |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 348 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 349 | uncollect_args |
| 350 | mov rsp,rbp ; rsp <- aligned rbp |
| 351 | pop rsp ; rsp <- original rbp |
| 352 | pop rbp |
| 353 | ret |
DRC | 132b5fd | 2009-10-08 09:04:56 +0000 | [diff] [blame] | 354 | |
| 355 | ; For some reason, the OS X linker does not honor the request to align the |
| 356 | ; segment unless we do this. |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 357 | align 16 |