Commit 2a3417b0 authored by Sam Hocevar's avatar Sam Hocevar

* common/amd64/*.asm: use RIP-related addressing in PIC mode.


git-svn-id: svn://svn.videolan.org/x264/trunk@303 df754926-b1dd-0310-bc7b-ec298dee348c
parent 77997bff
......@@ -36,6 +36,12 @@ BITS 64
; Macros and other preprocessor constants
;=============================================================================
%ifdef __PIC__
%define GLOBAL wrt rip
%else
%define GLOBAL
%endif
%macro cglobal 1
%ifdef PREFIX
global _%1
......@@ -177,7 +183,7 @@ x264_dct4x4dc_mmxext:
MMX_TRANSPOSE mm0, mm2, mm3, mm4, mm1 ; in: mm0, mm2, mm3, mm4 out: mm0, mm4, mm1, mm3
movq mm6, [x264_mmx_1]
movq mm6, [x264_mmx_1 GLOBAL]
paddw mm0, mm6
paddw mm4, mm6
psraw mm0, 1
......@@ -301,7 +307,7 @@ x264_add4x4_idct_mmxext:
MMX_SUMSUB_BADC mm2, mm3, mm4, mm1 ; mm2=s02+s13 mm3=s02-s13 mm4=d02+d13 mm1=d02-d13
MMX_ZERO mm7
movq mm6, [x264_mmx_32]
movq mm6, [x264_mmx_32 GLOBAL]
MMX_STORE_DIFF_4P mm2, mm0, mm6, mm7, [rax]
MMX_STORE_DIFF_4P mm4, mm0, mm6, mm7, [rax+rcx]
......@@ -390,10 +396,10 @@ ALIGN 16
;-----------------------------------------------------------------------------
x264_xdct8_mmxext:
movq mm5, [x264_mmx_PPNN]
movq mm6, [x264_mmx_PNNP]
movq mm4, [x264_mmx_PPPN]
movq mm7, [x264_mmx_PPNP]
movq mm5, [x264_mmx_PPNN GLOBAL]
movq mm6, [x264_mmx_PNNP GLOBAL]
movq mm4, [x264_mmx_PPPN GLOBAL]
movq mm7, [x264_mmx_PPNP GLOBAL]
;-------------------------------------------------------------------------
; horizontal dct ( compute 1 row at a time -> 8 loops )
......@@ -427,7 +433,7 @@ x264_xdct8_mmxext:
pshufw mm2, mm0, 11001001b ; (low)a1/a3/a0/a2(high)
pshufw mm0, mm0, 10011100b ; (low)a0/a2/a1/a3(high)
pmullw mm2, [x264_mmx_2121]
pmullw mm2, [x264_mmx_2121 GLOBAL]
pmullw mm0, mm5 ; (low)a0/a2/-a1/-a3(high)
psraw mm2, 1 ; (low)a1/a3>>1/a0/a2>>1(high)
paddw mm0, mm2 ; (low)dst0/dst2/dst4/dst6(high)
......@@ -540,10 +546,10 @@ ALIGN 16
;-----------------------------------------------------------------------------
x264_xidct8_mmxext:
movq mm4, [x264_mmx_PPNN]
movq mm5, [x264_mmx_PNPN]
movq mm6, [x264_mmx_PPNP]
movq mm7, [x264_mmx_PPPN]
movq mm4, [x264_mmx_PPNN GLOBAL]
movq mm5, [x264_mmx_PNPN GLOBAL]
movq mm6, [x264_mmx_PPNP GLOBAL]
movq mm7, [x264_mmx_PPPN GLOBAL]
;-------------------------------------------------------------------------
; horizontal idct ( compute 1 row at a time -> 8 loops )
......@@ -559,7 +565,8 @@ x264_xidct8_mmxext:
punpckhwd mm1, mm2 ; (low)d1,d5,d3,d7(high)
pshufw mm2, mm0, 10110001b ; (low)d4,d0,d6,d2(high)
pmullw mm0, [x264_mmx_p2n2p1p1]; (low)2*d0,-2*d4,d2,d6(high)
pmullw mm0, [x264_mmx_p2n2p1p1 GLOBAL]
; (low)2*d0,-2*d4,d2,d6(high)
pmullw mm2, mm6 ; (low)d4,d0,-d6,d2(high)
psraw mm0, 1 ; (low)d0,-d4,d2>>1,d6>>1(high)
paddw mm0, mm2 ; (low)e0,e2,e4,e6(high)
......
......@@ -36,6 +36,12 @@ BITS 64
; Macros and other preprocessor constants
;=============================================================================
%ifdef __PIC__
%define GLOBAL wrt rip
%else
%define GLOBAL
%endif
%macro cglobal 1
%ifdef PREFIX
global _%1
......@@ -390,7 +396,7 @@ x264_mc_chroma_sse:
pshufw mm5, mm0, 0 ; mm5 - dx
pshufw mm6, mm1, 0 ; mm6 - dy
movq mm4, [eights]
movq mm4, [eights GLOBAL]
movq mm0, mm4
psubw mm4, mm5 ; mm4 - 8-dx
......@@ -431,7 +437,7 @@ ALIGN 4
punpcklbw mm2, mm3
punpcklbw mm1, mm3
paddw mm0, [thirty2s]
paddw mm0, [thirty2s GLOBAL]
pmullw mm2, mm5 ; line * cB
pmullw mm1, mm7 ; line * cD
......
......@@ -24,6 +24,12 @@ BITS 64
; Macros and other preprocessor constants
;=============================================================================
%ifdef __PIC__
%define GLOBAL wrt rip
%else
%define GLOBAL
%endif
%macro cglobal 1
%ifdef PREFIX
global _%1
......@@ -156,8 +162,8 @@ x264_center_filter_mmxext :
lea rbx, [r13 + r13 * 2] ; 3 * src_stride
lea rdx, [r13 + r13 * 4] ; 5 * src_stride
pxor mm0, mm0 ; 0 ---> mm0
movq mm7, [mmx_dd_one] ; for rounding
pxor mm0, mm0 ; 0 ---> mm0
movq mm7, [mmx_dd_one GLOBAL] ; for rounding
loopcy:
......@@ -169,7 +175,7 @@ loopcy:
pshufw mm2, mm1, 0
movq [rsp + tbuffer], mm2
movq [rsp + tbuffer + 8], mm1
paddw mm1, [mmx_dw_one]
paddw mm1, [mmx_dw_one GLOBAL]
psraw mm1, 5
packuswb mm1, mm1
......@@ -184,7 +190,7 @@ loopcx1:
FILT_ALL rsi
movq [rsp + tbuffer + 2 * rax], mm1
paddw mm1, [mmx_dw_one]
paddw mm1, [mmx_dw_one GLOBAL]
psraw mm1, 5
packuswb mm1, mm1
movd [rdi + rax], mm1 ; dst1[rax - 4] = mm1
......@@ -199,7 +205,7 @@ loopcx1:
pshufw mm2, mm1, 7
movq [rsp + tbuffer + 2 * rax], mm1
movq [rsp + tbuffer + 2 * rax + 8], mm2
paddw mm1, [mmx_dw_one]
paddw mm1, [mmx_dw_one GLOBAL]
psraw mm1, 5
packuswb mm1, mm1
movd [rdi + rax], mm1 ; dst1[rax - 4] = mm1
......@@ -222,15 +228,15 @@ loopcx2:
paddw mm3, mm4
paddw mm1, mm6
movq mm5, [mmx_dw_20]
movq mm4, [mmx_dw_5]
movq mm5, [mmx_dw_20 GLOBAL]
movq mm4, [mmx_dw_5 GLOBAL]
movq mm6, mm1
pxor mm7, mm7
punpckhwd mm5, mm2
punpcklwd mm4, mm3
punpcklwd mm2, [mmx_dw_20]
punpckhwd mm3, [mmx_dw_5]
punpcklwd mm2, [mmx_dw_20 GLOBAL]
punpckhwd mm3, [mmx_dw_5 GLOBAL]
pcmpgtw mm7, mm1
......@@ -243,8 +249,8 @@ loopcx2:
paddd mm2, mm1
paddd mm3, mm6
paddd mm2, [mmx_dd_one]
paddd mm3, [mmx_dd_one]
paddd mm2, [mmx_dd_one GLOBAL]
paddd mm3, [mmx_dd_one GLOBAL]
psrad mm2, 10
psrad mm3, 10
......@@ -293,7 +299,7 @@ x264_horizontal_filter_mmxext :
mov rsi, rdx ; src
pxor mm0, mm0
movq mm7, [mmx_dw_one]
movq mm7, [mmx_dw_one GLOBAL]
movsxd rcx, r9d ; height
......
......@@ -26,6 +26,12 @@ BITS 64
; Macros and other preprocessor constants
;=============================================================================
%ifdef __PIC__
%define GLOBAL wrt rip
%else
%define GLOBAL
%endif
%macro cglobal 1
%ifdef PREFIX
global _%1
......@@ -402,7 +408,7 @@ x264_pixel_ssd_16x8_sse2:
movdqa %2, %1
psrldq %1, 2
paddusw %1, %2
pand %1, [pd_0000ffff]
pand %1, [pd_0000ffff GLOBAL]
movdqa %2, %1
psrldq %1, 4
paddd %1, %2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment