| 1 |
/* |
| 2 |
dct64_x86_64_float: SSE optimized dct64 for x86-64 (float output version) |
| 3 |
|
| 4 |
copyright 1995-2026 by the mpg123 project - free software under the terms of the LGPL 2.1 |
| 5 |
see COPYING and AUTHORS files in distribution or http://mpg123.org |
| 6 |
initially written by Taihei Monma |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "x86_64_defs.h" |
| 10 |
#include "mangle.h" |
| 11 |
|
| 12 |
#ifdef IS_MSABI |
| 13 |
/* short *out0 */ |
| 14 |
#define ARG0 %r9 |
| 15 |
/* short *out1 */ |
| 16 |
#define ARG1 %rdx |
| 17 |
/* real *samples */ |
| 18 |
#define ARG2 %r8 |
| 19 |
#else |
| 20 |
/* real *out0 */ |
| 21 |
#define ARG0 %rdi |
| 22 |
/* real *out1 */ |
| 23 |
#define ARG1 %rsi |
| 24 |
/* real *samples */ |
| 25 |
#define ARG2 %rdx |
| 26 |
#endif |
| 27 |
|
| 28 |
/* |
| 29 |
void dct64_real_x86_64(real *out0, real *out1, real *samples); |
| 30 |
*/ |
| 31 |
|
| 32 |
RODATA |
| 33 |
ALIGN32 |
| 34 |
ASM_NAME(INT123_costab_x86_64): |
| 35 |
.long 1056974725 |
| 36 |
.long 1057056395 |
| 37 |
.long 1057223771 |
| 38 |
.long 1057485416 |
| 39 |
.long 1057855544 |
| 40 |
.long 1058356026 |
| 41 |
.long 1059019886 |
| 42 |
.long 1059897405 |
| 43 |
.long 1061067246 |
| 44 |
.long 1062657950 |
| 45 |
.long 1064892987 |
| 46 |
.long 1066774581 |
| 47 |
.long 1069414683 |
| 48 |
.long 1073984175 |
| 49 |
.long 1079645762 |
| 50 |
.long 1092815430 |
| 51 |
.long 1057005197 |
| 52 |
.long 1057342072 |
| 53 |
.long 1058087743 |
| 54 |
.long 1059427869 |
| 55 |
.long 1061799040 |
| 56 |
.long 1065862217 |
| 57 |
.long 1071413542 |
| 58 |
.long 1084439708 |
| 59 |
.long 1057128951 |
| 60 |
.long 1058664893 |
| 61 |
.long 1063675095 |
| 62 |
.long 1076102863 |
| 63 |
.long 1057655764 |
| 64 |
.long 1067924853 |
| 65 |
.long 1060439283 |
| 66 |
.long 0 |
| 67 |
.text |
| 68 |
ALIGN16 |
| 69 |
.globl ASM_NAME(INT123_dct64_real_x86_64) |
| 70 |
ASM_NAME(INT123_dct64_real_x86_64): |
| 71 |
#ifdef IS_MSABI /* should save xmm6-15 */ |
| 72 |
movq %rcx, ARG0 |
| 73 |
subq $168, %rsp /* stack alignment + 10 xmm registers */ |
| 74 |
movaps %xmm6, (%rsp) |
| 75 |
movaps %xmm7, 16(%rsp) |
| 76 |
movaps %xmm8, 32(%rsp) |
| 77 |
movaps %xmm9, 48(%rsp) |
| 78 |
movaps %xmm10, 64(%rsp) |
| 79 |
movaps %xmm11, 80(%rsp) |
| 80 |
movaps %xmm12, 96(%rsp) |
| 81 |
movaps %xmm13, 112(%rsp) |
| 82 |
movaps %xmm14, 128(%rsp) |
| 83 |
movaps %xmm15, 144(%rsp) |
| 84 |
#endif |
| 85 |
|
| 86 |
leaq ASM_NAME(INT123_costab_x86_64)(%rip), %rcx |
| 87 |
|
| 88 |
MOVUAPS (ARG2), %xmm15 |
| 89 |
MOVUAPS 16(ARG2), %xmm14 |
| 90 |
MOVUAPS 112(ARG2), %xmm0 |
| 91 |
MOVUAPS 96(ARG2), %xmm1 |
| 92 |
shufps $0x1b, %xmm0, %xmm0 |
| 93 |
shufps $0x1b, %xmm1, %xmm1 |
| 94 |
movaps %xmm15, %xmm8 |
| 95 |
movaps %xmm14, %xmm9 |
| 96 |
addps %xmm0, %xmm8 |
| 97 |
addps %xmm1, %xmm9 |
| 98 |
subps %xmm0, %xmm15 |
| 99 |
subps %xmm1, %xmm14 |
| 100 |
|
| 101 |
MOVUAPS 32(ARG2), %xmm13 |
| 102 |
MOVUAPS 48(ARG2), %xmm12 |
| 103 |
MOVUAPS 80(ARG2), %xmm0 |
| 104 |
MOVUAPS 64(ARG2), %xmm1 |
| 105 |
shufps $0x1b, %xmm0, %xmm0 |
| 106 |
shufps $0x1b, %xmm1, %xmm1 |
| 107 |
movaps %xmm13, %xmm10 |
| 108 |
movaps %xmm12, %xmm11 |
| 109 |
addps %xmm0, %xmm10 |
| 110 |
addps %xmm1, %xmm11 |
| 111 |
subps %xmm0, %xmm13 |
| 112 |
subps %xmm1, %xmm12 |
| 113 |
|
| 114 |
movaps (%rcx), %xmm0 |
| 115 |
movaps 16(%rcx), %xmm1 |
| 116 |
movaps 32(%rcx), %xmm2 |
| 117 |
movaps 48(%rcx), %xmm3 |
| 118 |
mulps %xmm0, %xmm15 |
| 119 |
mulps %xmm1, %xmm14 |
| 120 |
mulps %xmm2, %xmm13 |
| 121 |
mulps %xmm3, %xmm12 |
| 122 |
|
| 123 |
movaps 64(%rcx), %xmm0 |
| 124 |
movaps 80(%rcx), %xmm1 |
| 125 |
|
| 126 |
pshufd $0x1b, %xmm11, %xmm2 |
| 127 |
pshufd $0x1b, %xmm10, %xmm3 |
| 128 |
shufps $0x1b, %xmm13, %xmm13 |
| 129 |
shufps $0x1b, %xmm12, %xmm12 |
| 130 |
movaps %xmm8, %xmm11 |
| 131 |
movaps %xmm9, %xmm10 |
| 132 |
movaps %xmm14, %xmm4 |
| 133 |
movaps %xmm15, %xmm5 |
| 134 |
subps %xmm2, %xmm11 |
| 135 |
subps %xmm3, %xmm10 |
| 136 |
subps %xmm13, %xmm14 |
| 137 |
subps %xmm12, %xmm15 |
| 138 |
addps %xmm2, %xmm8 |
| 139 |
addps %xmm3, %xmm9 |
| 140 |
addps %xmm5, %xmm12 |
| 141 |
addps %xmm4, %xmm13 |
| 142 |
mulps %xmm0, %xmm11 |
| 143 |
mulps %xmm1, %xmm10 |
| 144 |
mulps %xmm1, %xmm14 |
| 145 |
mulps %xmm0, %xmm15 |
| 146 |
|
| 147 |
movaps 96(%rcx), %xmm0 |
| 148 |
|
| 149 |
pshufd $0x1b, %xmm9, %xmm1 |
| 150 |
pshufd $0x1b, %xmm13, %xmm2 |
| 151 |
shufps $0x1b, %xmm10, %xmm10 |
| 152 |
shufps $0x1b, %xmm14, %xmm14 |
| 153 |
movaps %xmm8, %xmm9 |
| 154 |
movaps %xmm12, %xmm13 |
| 155 |
movaps %xmm11, %xmm3 |
| 156 |
movaps %xmm15, %xmm4 |
| 157 |
subps %xmm1, %xmm9 |
| 158 |
subps %xmm2, %xmm13 |
| 159 |
subps %xmm10, %xmm11 |
| 160 |
subps %xmm14, %xmm15 |
| 161 |
addps %xmm1, %xmm8 |
| 162 |
addps %xmm2, %xmm12 |
| 163 |
addps %xmm3, %xmm10 |
| 164 |
addps %xmm4, %xmm14 |
| 165 |
mulps %xmm0, %xmm9 |
| 166 |
mulps %xmm0, %xmm13 |
| 167 |
mulps %xmm0, %xmm11 |
| 168 |
mulps %xmm0, %xmm15 |
| 169 |
|
| 170 |
movaps 112(%rcx), %xmm0 |
| 171 |
movaps %xmm0, %xmm1 |
| 172 |
movlhps %xmm1, %xmm1 |
| 173 |
|
| 174 |
movaps %xmm8, %xmm2 |
| 175 |
movaps %xmm9, %xmm3 |
| 176 |
shufps $0x44, %xmm10, %xmm2 |
| 177 |
shufps $0xbb, %xmm11, %xmm9 |
| 178 |
shufps $0xbb, %xmm10, %xmm8 |
| 179 |
shufps $0x44, %xmm11, %xmm3 |
| 180 |
movaps %xmm2, %xmm4 |
| 181 |
movaps %xmm3, %xmm5 |
| 182 |
subps %xmm8, %xmm2 |
| 183 |
subps %xmm9, %xmm3 |
| 184 |
addps %xmm4, %xmm8 |
| 185 |
addps %xmm5, %xmm9 |
| 186 |
mulps %xmm1, %xmm2 |
| 187 |
mulps %xmm1, %xmm3 |
| 188 |
movaps %xmm8, %xmm10 |
| 189 |
movaps %xmm9, %xmm11 |
| 190 |
shufps $0x14, %xmm2, %xmm8 |
| 191 |
shufps $0xbe, %xmm2, %xmm10 |
| 192 |
shufps $0x14, %xmm3, %xmm9 |
| 193 |
shufps $0xbe, %xmm3, %xmm11 |
| 194 |
|
| 195 |
movaps %xmm12, %xmm2 |
| 196 |
movaps %xmm13, %xmm3 |
| 197 |
shufps $0x44, %xmm14, %xmm2 |
| 198 |
shufps $0xbb, %xmm15, %xmm13 |
| 199 |
shufps $0xbb, %xmm14, %xmm12 |
| 200 |
shufps $0x44, %xmm15, %xmm3 |
| 201 |
movaps %xmm2, %xmm4 |
| 202 |
movaps %xmm3, %xmm5 |
| 203 |
subps %xmm12, %xmm2 |
| 204 |
subps %xmm13, %xmm3 |
| 205 |
addps %xmm4, %xmm12 |
| 206 |
addps %xmm5, %xmm13 |
| 207 |
mulps %xmm1, %xmm2 |
| 208 |
mulps %xmm1, %xmm3 |
| 209 |
movaps %xmm12, %xmm14 |
| 210 |
movaps %xmm13, %xmm15 |
| 211 |
shufps $0x14, %xmm2, %xmm12 |
| 212 |
shufps $0xbe, %xmm2, %xmm14 |
| 213 |
shufps $0x14, %xmm3, %xmm13 |
| 214 |
shufps $0xbe, %xmm3, %xmm15 |
| 215 |
|
| 216 |
shufps $0xaa, %xmm0, %xmm0 |
| 217 |
pcmpeqd %xmm1, %xmm1 |
| 218 |
pslld $31, %xmm1 |
| 219 |
psllq $32, %xmm1 |
| 220 |
xorps %xmm1, %xmm0 |
| 221 |
|
| 222 |
movaps %xmm8, %xmm1 |
| 223 |
movaps %xmm10, %xmm2 |
| 224 |
unpcklps %xmm9, %xmm8 |
| 225 |
unpckhps %xmm9, %xmm1 |
| 226 |
unpcklps %xmm11, %xmm10 |
| 227 |
unpckhps %xmm11, %xmm2 |
| 228 |
movaps %xmm8, %xmm3 |
| 229 |
movaps %xmm10, %xmm4 |
| 230 |
unpcklps %xmm1, %xmm8 |
| 231 |
unpckhps %xmm1, %xmm3 |
| 232 |
unpcklps %xmm2, %xmm10 |
| 233 |
unpckhps %xmm2, %xmm4 |
| 234 |
movaps %xmm8, %xmm1 |
| 235 |
movaps %xmm10, %xmm2 |
| 236 |
subps %xmm3, %xmm1 |
| 237 |
subps %xmm4, %xmm2 |
| 238 |
addps %xmm3, %xmm8 |
| 239 |
addps %xmm4, %xmm10 |
| 240 |
mulps %xmm0, %xmm1 |
| 241 |
mulps %xmm0, %xmm2 |
| 242 |
movaps %xmm8, %xmm9 |
| 243 |
movaps %xmm10, %xmm11 |
| 244 |
unpcklps %xmm1, %xmm8 |
| 245 |
unpckhps %xmm1, %xmm9 |
| 246 |
unpcklps %xmm2, %xmm10 |
| 247 |
unpckhps %xmm2, %xmm11 |
| 248 |
|
| 249 |
movaps %xmm12, %xmm1 |
| 250 |
movaps %xmm14, %xmm2 |
| 251 |
unpcklps %xmm13, %xmm12 |
| 252 |
unpckhps %xmm13, %xmm1 |
| 253 |
unpcklps %xmm15, %xmm14 |
| 254 |
unpckhps %xmm15, %xmm2 |
| 255 |
movaps %xmm12, %xmm3 |
| 256 |
movaps %xmm14, %xmm4 |
| 257 |
unpcklps %xmm1, %xmm12 |
| 258 |
unpckhps %xmm1, %xmm3 |
| 259 |
unpcklps %xmm2, %xmm14 |
| 260 |
unpckhps %xmm2, %xmm4 |
| 261 |
movaps %xmm12, %xmm1 |
| 262 |
movaps %xmm14, %xmm2 |
| 263 |
subps %xmm3, %xmm1 |
| 264 |
subps %xmm4, %xmm2 |
| 265 |
addps %xmm3, %xmm12 |
| 266 |
addps %xmm4, %xmm14 |
| 267 |
mulps %xmm0, %xmm1 |
| 268 |
mulps %xmm0, %xmm2 |
| 269 |
movaps %xmm12, %xmm13 |
| 270 |
movaps %xmm14, %xmm15 |
| 271 |
unpcklps %xmm1, %xmm12 |
| 272 |
unpckhps %xmm1, %xmm13 |
| 273 |
unpcklps %xmm2, %xmm14 |
| 274 |
unpckhps %xmm2, %xmm15 |
| 275 |
|
| 276 |
|
| 277 |
xorps %xmm0, %xmm0 |
| 278 |
xorps %xmm1, %xmm1 |
| 279 |
shufpd $0x2, %xmm8, %xmm0 |
| 280 |
shufpd $0x2, %xmm9, %xmm1 |
| 281 |
psrlq $32, %xmm0 |
| 282 |
psrlq $32, %xmm1 |
| 283 |
addps %xmm0, %xmm8 |
| 284 |
addps %xmm1, %xmm9 |
| 285 |
|
| 286 |
xorps %xmm0, %xmm0 |
| 287 |
xorps %xmm1, %xmm1 |
| 288 |
shufpd $0x2, %xmm10, %xmm0 |
| 289 |
shufpd $0x2, %xmm11, %xmm1 |
| 290 |
psrlq $32, %xmm0 |
| 291 |
psrlq $32, %xmm1 |
| 292 |
addps %xmm0, %xmm10 |
| 293 |
addps %xmm1, %xmm11 |
| 294 |
|
| 295 |
xorps %xmm0, %xmm0 |
| 296 |
xorps %xmm1, %xmm1 |
| 297 |
shufpd $0x2, %xmm12, %xmm0 |
| 298 |
shufpd $0x2, %xmm13, %xmm1 |
| 299 |
psrlq $32, %xmm0 |
| 300 |
psrlq $32, %xmm1 |
| 301 |
addps %xmm0, %xmm12 |
| 302 |
addps %xmm1, %xmm13 |
| 303 |
|
| 304 |
xorps %xmm0, %xmm0 |
| 305 |
xorps %xmm1, %xmm1 |
| 306 |
shufpd $0x2, %xmm14, %xmm0 |
| 307 |
shufpd $0x2, %xmm15, %xmm1 |
| 308 |
psrlq $32, %xmm0 |
| 309 |
psrlq $32, %xmm1 |
| 310 |
addps %xmm0, %xmm14 |
| 311 |
addps %xmm1, %xmm15 |
| 312 |
|
| 313 |
pshufd $0x78, %xmm9, %xmm0 |
| 314 |
pshufd $0x78, %xmm11, %xmm1 |
| 315 |
pshufd $0x78, %xmm13, %xmm2 |
| 316 |
pshufd $0x78, %xmm15, %xmm3 |
| 317 |
psrldq $4, %xmm0 |
| 318 |
psrldq $4, %xmm1 |
| 319 |
psrldq $4, %xmm2 |
| 320 |
psrldq $4, %xmm3 |
| 321 |
addps %xmm0, %xmm9 |
| 322 |
addps %xmm1, %xmm11 |
| 323 |
addps %xmm2, %xmm13 |
| 324 |
addps %xmm3, %xmm15 |
| 325 |
|
| 326 |
pshufd $0x78, %xmm10, %xmm0 |
| 327 |
pshufd $0x78, %xmm14, %xmm1 |
| 328 |
psrldq $4, %xmm0 |
| 329 |
psrldq $4, %xmm1 |
| 330 |
addps %xmm11, %xmm10 |
| 331 |
addps %xmm15, %xmm14 |
| 332 |
addps %xmm0, %xmm11 |
| 333 |
addps %xmm1, %xmm15 |
| 334 |
|
| 335 |
|
| 336 |
movss %xmm8, 1024(ARG0) |
| 337 |
movss %xmm10, 896(ARG0) |
| 338 |
movss %xmm9, 768(ARG0) |
| 339 |
movss %xmm11, 640(ARG0) |
| 340 |
movhlps %xmm8, %xmm0 |
| 341 |
movhlps %xmm10, %xmm1 |
| 342 |
movhlps %xmm9, %xmm2 |
| 343 |
movhlps %xmm11, %xmm3 |
| 344 |
movss %xmm0, 512(ARG0) |
| 345 |
movss %xmm1, 384(ARG0) |
| 346 |
movss %xmm2, 256(ARG0) |
| 347 |
movss %xmm3, 128(ARG0) |
| 348 |
|
| 349 |
pshuflw $0xee, %xmm8, %xmm4 |
| 350 |
pshuflw $0xee, %xmm10, %xmm5 |
| 351 |
pshuflw $0xee, %xmm9, %xmm6 |
| 352 |
pshuflw $0xee, %xmm11, %xmm7 |
| 353 |
movss %xmm4, (ARG0) |
| 354 |
movss %xmm4, (ARG1) |
| 355 |
movss %xmm5, 128(ARG1) |
| 356 |
movss %xmm6, 256(ARG1) |
| 357 |
movss %xmm7, 384(ARG1) |
| 358 |
|
| 359 |
pshuflw $0xee, %xmm0, %xmm0 |
| 360 |
pshuflw $0xee, %xmm1, %xmm1 |
| 361 |
pshuflw $0xee, %xmm2, %xmm2 |
| 362 |
pshuflw $0xee, %xmm3, %xmm3 |
| 363 |
movss %xmm0, 512(ARG1) |
| 364 |
movss %xmm1, 640(ARG1) |
| 365 |
movss %xmm2, 768(ARG1) |
| 366 |
movss %xmm3, 896(ARG1) |
| 367 |
|
| 368 |
pshufd $0x78, %xmm12, %xmm0 |
| 369 |
movaps %xmm13, %xmm1 |
| 370 |
psrldq $4, %xmm0 |
| 371 |
|
| 372 |
addps %xmm14, %xmm12 |
| 373 |
addps %xmm15, %xmm13 |
| 374 |
addps %xmm1, %xmm14 |
| 375 |
addps %xmm0, %xmm15 |
| 376 |
|
| 377 |
movss %xmm12, 960(ARG0) |
| 378 |
movss %xmm14, 832(ARG0) |
| 379 |
movss %xmm13, 704(ARG0) |
| 380 |
movss %xmm15, 576(ARG0) |
| 381 |
movhlps %xmm12, %xmm0 |
| 382 |
movhlps %xmm14, %xmm1 |
| 383 |
movhlps %xmm13, %xmm2 |
| 384 |
movhlps %xmm15, %xmm3 |
| 385 |
movss %xmm0, 448(ARG0) |
| 386 |
movss %xmm1, 320(ARG0) |
| 387 |
movss %xmm2, 192(ARG0) |
| 388 |
movss %xmm3, 64(ARG0) |
| 389 |
|
| 390 |
pshuflw $0xee, %xmm12, %xmm4 |
| 391 |
pshuflw $0xee, %xmm14, %xmm5 |
| 392 |
pshuflw $0xee, %xmm13, %xmm6 |
| 393 |
pshuflw $0xee, %xmm15, %xmm7 |
| 394 |
movss %xmm4, 64(ARG1) |
| 395 |
movss %xmm5, 192(ARG1) |
| 396 |
movss %xmm6, 320(ARG1) |
| 397 |
movss %xmm7, 448(ARG1) |
| 398 |
|
| 399 |
pshuflw $0xee, %xmm0, %xmm0 |
| 400 |
pshuflw $0xee, %xmm1, %xmm1 |
| 401 |
pshuflw $0xee, %xmm2, %xmm2 |
| 402 |
pshuflw $0xee, %xmm3, %xmm3 |
| 403 |
movss %xmm0, 576(ARG1) |
| 404 |
movss %xmm1, 704(ARG1) |
| 405 |
movss %xmm2, 832(ARG1) |
| 406 |
movss %xmm3, 960(ARG1) |
| 407 |
|
| 408 |
#ifdef IS_MSABI |
| 409 |
movaps (%rsp), %xmm6 |
| 410 |
movaps 16(%rsp), %xmm7 |
| 411 |
movaps 32(%rsp), %xmm8 |
| 412 |
movaps 48(%rsp), %xmm9 |
| 413 |
movaps 64(%rsp), %xmm10 |
| 414 |
movaps 80(%rsp), %xmm11 |
| 415 |
movaps 96(%rsp), %xmm12 |
| 416 |
movaps 112(%rsp), %xmm13 |
| 417 |
movaps 128(%rsp), %xmm14 |
| 418 |
movaps 144(%rsp), %xmm15 |
| 419 |
addq $168, %rsp |
| 420 |
#endif |
| 421 |
ret |
| 422 |
|
| 423 |
NONEXEC_STACK |