Utilize program counter-relative offsets to simplify X86_32_PICASM code. In order for this to work with nasm, data constants are placed in the text segment.
Showing the changes to codec/processing/src (1 of 1 file). Show all
Unified · Split
| @@ -44,7 +44,11 @@ · 43 unmodified lines | ||
| 44 | 44 | ;*********************************************************************** |
| 45 | 45 | ; Constant |
| 46 | 46 | ;*********************************************************************** |
| 47 | +%ifdef X86_32_PICASM | |
| 48 | +SECTION .text align=16 | |
| 49 | +%else | |
| 47 | 50 | SECTION .rodata align=16 |
| 51 | +%endif | |
| 48 | 52 | |
| 49 | 53 | sse2_32 times 8 dw 32 |
| 50 | 54 | sse2_20 times 8 dw 20 |
| @@ -147,20 +151,7 @@ SECTION .text · 96 unmodified lines | ||
| 147 | 151 | movdqa %2, %1 |
| 148 | 152 | psrldq %2, 2 |
| 149 | 153 | punpcklbw %2, %4 |
| 150 | −%ifdef X86_32_PICASM | |
| 151 | − push r0 | |
| 152 | − mov r0, esp | |
| 153 | − and esp, 0xfffffff0 | |
| 154 | − push 0x00140014 | |
| 155 | − push 0x00140014 | |
| 156 | − push 0x00140014 | |
| 157 | − push 0x00140014 | |
| 158 | − pmullw %2, [esp] | |
| 159 | − mov esp, r0 | |
| 160 | − pop r0 | |
| 161 | −%else | |
| 162 | − pmullw %2, [sse2_20] | |
| 163 | −%endif | |
| 154 | + pmullw %2, [pic(sse2_20)] | |
| 164 | 155 | paddw %3, %2 |
| 165 | 156 | |
| 166 | 157 | movdqa %2, %1 |
| @@ -254,6 +245,7 @@ WELS_EXTERN WaverageChromaFilter8_sse2 · 87 unmodified lines | ||
| 254 | 245 | |
| 255 | 246 | %assign push_num 1 |
| 256 | 247 | |
| 248 | + INIT_X86_32_PIC r4 | |
| 257 | 249 | LOAD_2_PARA |
| 258 | 250 | |
| 259 | 251 | mov r3, r1 |
| @@ -285,6 +277,7 @@ WELS_EXTERN WaverageChromaFilter8_sse2 · 25 unmodified lines | ||
| 285 | 277 | movq [r0 + 2], xmm3 |
| 286 | 278 | |
| 287 | 279 | |
| 280 | + DEINIT_X86_32_PIC | |
| 288 | 281 | pop r3 |
| 289 | 282 | |
| 290 | 283 | %assign push_num 0 |