r25254 - trunk/libavcodec/x86/h264dsp_mmx.c
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254 Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. Modified: trunk/libavcodec/x86/h264dsp_mmx.c Modified: trunk/libavcodec/x86/h264dsp_mmx.c ============================================================================== --- trunk/libavcodec/x86/h264dsp_mmx.c Wed Sep 29 15:35:24 2010 (r25253) +++ trunk/libavcodec/x86/h264dsp_mmx.c Wed Sep 29 16:02:32 2010 (r25254) @@ -66,9 +66,8 @@ void ff_h264_idct_add8_sse2 (uint8_ static av_always_inline void h264_loop_filter_strength_iteration_mmx2(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], int bidir, int edges, int step, - int mask_mv, int dir) + int mask_mv, int dir, const int d_idx) { - const x86_reg d_idx = dir ? -8 : -1; DECLARE_ALIGNED(8, const uint64_t, mask_dir) = dir ? 0 : 0xffffffffffffffffULL; int b_idx, edge; for( b_idx=12, edge=0; edge<edges; edge+=step, b_idx+=8*step ) { @@ -79,23 +78,23 @@ static av_always_inline void h264_loop_f if(!(mask_mv & edge)) { if(bidir) { __asm__ volatile( - "movd (%1,%0), %%mm2 \n" - "punpckldq 40(%1,%0), %%mm2 \n" // { ref0[bn], ref1[bn] } - "pshufw $0x44, (%1), %%mm0 \n" // { ref0[b], ref0[b] } - "pshufw $0x44, 40(%1), %%mm1 \n" // { ref1[b], ref1[b] } + "movd %a2(%0), %%mm2 \n" + "punpckldq %a3(%0), %%mm2 \n" // { ref0[bn], ref1[bn] } + "pshufw $0x44, (%0), %%mm0 \n" // { ref0[b], ref0[b] } + "pshufw $0x44, 40(%0), %%mm1 \n" // { ref1[b], ref1[b] } "pshufw $0x4E, %%mm2, %%mm3 \n" "psubb %%mm2, %%mm0 \n" // { ref0[b]!=ref0[bn], ref0[b]!=ref1[bn] } "psubb %%mm3, %%mm1 \n" // { ref1[b]!=ref1[bn], ref1[b]!=ref0[bn] } "por %%mm1, %%mm0 \n" - "movq (%2,%0,4), %%mm1 \n" - "movq 8(%2,%0,4), %%mm2 \n" + "movq %a4(%1), %%mm1 \n" + "movq %a5(%1), %%mm2 \n" "movq %%mm1, %%mm3 \n" "movq %%mm2, %%mm4 \n" - "psubw (%2), %%mm1 \n" - "psubw 8(%2), %%mm2 \n" - "psubw 160(%2), %%mm3 \n" - "psubw 168(%2), %%mm4 \n" + "psubw (%1), %%mm1 \n" + "psubw 8(%1), %%mm2 \n" + "psubw 160(%1), %%mm3 \n" + "psubw 168(%1), %%mm4 \n" "packsswb %%mm2, %%mm1 \n" "packsswb %%mm4, %%mm3 \n" "paddb %%mm6, %%mm1 \n" @@ -105,14 +104,14 @@ static av_always_inline void h264_loop_f "packsswb %%mm3, %%mm1 \n" "por %%mm1, %%mm0 \n" - "movq 160(%2,%0,4), %%mm1 \n" - "movq 168(%2,%0,4), %%mm2 \n" + "movq %a6(%1), %%mm1 \n" + "movq %a7(%1), %%mm2 \n" "movq %%mm1, %%mm3 \n" "movq %%mm2, %%mm4 \n" - "psubw (%2), %%mm1 \n" - "psubw 8(%2), %%mm2 \n" - "psubw 160(%2), %%mm3 \n" - "psubw 168(%2), %%mm4 \n" + "psubw (%1), %%mm1 \n" + "psubw 8(%1), %%mm2 \n" + "psubw 160(%1), %%mm3 \n" + "psubw 168(%1), %%mm4 \n" "packsswb %%mm2, %%mm1 \n" "packsswb %%mm4, %%mm3 \n" "paddb %%mm6, %%mm1 \n" @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f "por %%mm1, %%mm0 \n" "pshufw $0x4E, %%mm0, %%mm1 \n" "pminub %%mm1, %%mm0 \n" - ::"r"(d_idx), - "r"(ref[0]+b_idx), - "r"(mv[0]+b_idx) + ::"r"(ref[0]+b_idx), + "r"(mv[0]+b_idx), + "i"(d_idx), + "i"(d_idx+40), + "i"(d_idx*4), + "i"(d_idx*4+8), + "i"(d_idx*4+160), + "i"(d_idx*4+168) ); } else { __asm__ volatile( "movd (%1), %%mm0 \n" - "psubb (%1,%0), %%mm0 \n" // ref[b] != ref[bn] + "psubb %a0(%1), %%mm0 \n" // ref[b] != ref[bn] "movq (%2), %%mm1 \n" "movq 8(%2), %%mm2 \n" - "psubw (%2,%0,4), %%mm1 \n" - "psubw 8(%2,%0,4), %%mm2 \n" + "psubw %a3(%2), %%mm1 \n" + "psubw %a4(%2), %%mm2 \n" "packsswb %%mm2, %%mm1 \n" "paddb %%mm6, %%mm1 \n" "psubusb %%mm5, %%mm1 \n" // abs(mv[b] - mv[bn]) >= limit "packsswb %%mm1, %%mm1 \n" "por %%mm1, %%mm0 \n" - ::"r"(d_idx), + ::"i"(d_idx), "r"(ref[0]+b_idx), - "r"(mv[0]+b_idx) + "r"(mv[0]+b_idx), + "i"(d_idx*4), + "i"(d_idx*4+8) ); } } __asm__ volatile( - "movd %0, %%mm1 \n" - "por %1, %%mm1 \n" // nnz[b] || nnz[bn] - ::"m"(nnz[b_idx]), - "m"(nnz[b_idx+d_idx]) + "movd (%0), %%mm1 \n" + "por %a1(%0), %%mm1 \n" // nnz[b] || nnz[bn] + ::"r"(nnz+b_idx), + "i"(d_idx) ); __asm__ volatile( "pminub %%mm7, %%mm1 \n" @@ -187,8 +193,8 @@ static void h264_loop_filter_strength_mm // could do a special case for dir==0 && edges==1, but it only reduces the // average filter time by 1.2% - h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, edges, step, mask_mv1, 1); - h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, 4, 1, mask_mv0, 0); + h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, edges, step, mask_mv1, 1, -8); + h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, 4, 1, mask_mv0, 0, -1); __asm__ volatile( "movq (%0), %%mm0 \n\t"
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f "por %%mm1, %%mm0 \n" "pshufw $0x4E, %%mm0, %%mm1 \n" "pminub %%mm1, %%mm0 \n" - ::"r"(d_idx), - "r"(ref[0]+b_idx), - "r"(mv[0]+b_idx) + ::"r"(ref[0]+b_idx), + "r"(mv[0]+b_idx), + "i"(d_idx), + "i"(d_idx+40), + "i"(d_idx*4), + "i"(d_idx*4+8), + "i"(d_idx*4+160), + "i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes
Hi, On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached. Ronald
On Wed, Sep 29, 2010 at 12:19:45PM -0400, Ronald S. Bultje wrote:
Hi,
On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached.
Iam starting to think that too in this case ... either way patch ok but see it positive we learnt about %a0 and that gcc 3 is not capable to propagete constants through always_inline functions, later can be usefull knowledge for pure C code optimizations or for interpreting why gcc 3 and 4 differ in speed of some code [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates
Hi, On Wed, Sep 29, 2010 at 1:11 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 12:19:45PM -0400, Ronald S. Bultje wrote:
On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached.
Iam starting to think that too in this case ... either way patch ok
Let's leave it as-is now, it was 3 cycles faster after all... If more stuff breaks or becomes strange, we can change it whenever we want... I was positively surprised that clang/icc worked with this code. :-). Ronald
Hi, On Wed, Sep 29, 2010 at 1:41 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
On Wed, Sep 29, 2010 at 1:11 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 12:19:45PM -0400, Ronald S. Bultje wrote:
On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached.
Iam starting to think that too in this case ... either way patch ok
Let's leave it as-is now, it was 3 cycles faster after all... If more stuff breaks or becomes strange, we can change it whenever we want... I was positively surprised that clang/icc worked with this code. :-).
Hmm, sunCC is still unhappy... http://fate.ffmpeg.org/x86_32-linux-suncc-5.11/20100929174548/compile Ronald
On Wed, Sep 29, 2010 at 02:10:23PM -0400, Ronald S. Bultje wrote:
Hi,
On Wed, Sep 29, 2010 at 1:41 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
On Wed, Sep 29, 2010 at 1:11 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 12:19:45PM -0400, Ronald S. Bultje wrote:
On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached.
Iam starting to think that too in this case ... either way patch ok
Let's leave it as-is now, it was 3 cycles faster after all... If more stuff breaks or becomes strange, we can change it whenever we want... I was positively surprised that clang/icc worked with this code. :-).
Hmm, sunCC is still unhappy...
http://fate.ffmpeg.org/x86_32-linux-suncc-5.11/20100929174548/compile
"h264dsp_mm.tmp.vpn.30352.i", [h264_loop_filter_strength_mmx2]:ube: error: Cannot allocate register for argument '%7' in GASM Inlining cc: ube failed for /home/mik/.ccache/tmp/h264dsp_mm.tmp.vpn.30352.i make: *** [libavcodec/x86/h264dsp_mmx.o] Error 2 There is no %7 in there just a %a7 and that is a constant and not a register. So my bet here is on compiler bug and that should be reported if anyone cares As workaround the constants can be inserted by the preprocessor also note that the asembler is able to do basic arithmetic you can take a look at simple_idct.c for examples of this [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes
Hi, On Wed, Sep 29, 2010 at 4:05 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 02:10:23PM -0400, Ronald S. Bultje wrote:
On Wed, Sep 29, 2010 at 1:41 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
On Wed, Sep 29, 2010 at 1:11 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 12:19:45PM -0400, Ronald S. Bultje wrote:
On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote: > Author: rbultje > Date: Wed Sep 29 16:02:32 2010 > New Revision: 25254 > > Log: > Remove d_idx as a variable, and instead load it as a constant in the asm. > This has no measurable speed effect because the surrounding code doesn't > take advantage of this yet. [...] > @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f > ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" > ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" > ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" > - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), > - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), > - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) > + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), > + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), > + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), > + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), > + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), > + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), > + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), > + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached.
Iam starting to think that too in this case ... either way patch ok
Let's leave it as-is now, it was 3 cycles faster after all... If more stuff breaks or becomes strange, we can change it whenever we want... I was positively surprised that clang/icc worked with this code. :-).
Hmm, sunCC is still unhappy...
http://fate.ffmpeg.org/x86_32-linux-suncc-5.11/20100929174548/compile
"h264dsp_mm.tmp.vpn.30352.i", [h264_loop_filter_strength_mmx2]:ube: error: Cannot allocate register for argument '%7' in GASM Inlining cc: ube failed for /home/mik/.ccache/tmp/h264dsp_mm.tmp.vpn.30352.i make: *** [libavcodec/x86/h264dsp_mmx.o] Error 2
There is no %7 in there just a %a7 and that is a constant and not a register. So my bet here is on compiler bug and that should be reported if anyone cares
Reported, caseID = 1880039 (it's not anywhere publically viewable (yet). Ronald
Michael Niedermayer <michaelni at gmx.at> writes:
On Wed, Sep 29, 2010 at 12:19:45PM -0400, Ronald S. Bultje wrote:
Hi,
On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached.
Iam starting to think that too in this case ...
...
either way patch ok
but see it positive we learnt about %a0
Is that one of those undocumented tricks they tell you not to use?
and that gcc 3 is not capable to propagete constants through always_inline functions,
I thought that was common knowledge. -- M?ns Rullg?rd mans at mansr.com
On Wed, Sep 29, 2010 at 08:56:50PM +0100, M?ns Rullg?rd wrote:
Michael Niedermayer <michaelni at gmx.at> writes:
On Wed, Sep 29, 2010 at 12:19:45PM -0400, Ronald S. Bultje wrote:
Hi,
On Wed, Sep 29, 2010 at 12:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
On Wed, Sep 29, 2010 at 04:02:32PM +0200, rbultje wrote:
Author: rbultje Date: Wed Sep 29 16:02:32 2010 New Revision: 25254
Log: Remove d_idx as a variable, and instead load it as a constant in the asm. This has no measurable speed effect because the surrounding code doesn't take advantage of this yet. [...] @@ -125,34 +124,41 @@ static av_always_inline void h264_loop_f ? ? ? ? ? ? ? ? ? ? ? ? ?"por ? ? ? ? ? %%mm1, %%mm0 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pshufw $0x4E, %%mm0, %%mm1 \n" ? ? ? ? ? ? ? ? ? ? ? ? ?"pminub ? ? ? ?%%mm1, %%mm0 \n" - ? ? ? ? ? ? ? ? ? ? ? ?::"r"(d_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(ref[0]+b_idx), - ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx) + ? ? ? ? ? ? ? ? ? ? ? ?::"r"(ref[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"r"(mv[0]+b_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx+40), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+8), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+160), + ? ? ? ? ? ? ? ? ? ? ? ? ?"i"(d_idx*4+168)
It appears that some gccs have difficulty with constant propagation, so i suspect that this has to be changed to a macro instead of a always_inline function
Grmbl, starting to think yasm is easier after all... Patch attached.
Iam starting to think that too in this case ...
...
either way patch ok
but see it positive we learnt about %a0
Is that one of those undocumented tricks they tell you not to use?
it does not seem so, no
and that gcc 3 is not capable to propagete constants through always_inline functions,
I thought that was common knowledge.
then i wonder why you didnt know it [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope
Michael Niedermayer <michaelni at gmx.at> writes:
and that gcc 3 is not capable to propagete constants through always_inline functions,
I thought that was common knowledge.
then i wonder why you didnt know it
I've known it for a long time. What makes you believe otherwise? That I didn't notice a problem in this patch while not paying attention to the thread _and_ being offline? -- M?ns Rullg?rd mans at mansr.com
participants (4)
-
mans@mansr.com -
michaelni@gmx.at -
rsbultje@gmail.com -
subversion@mplayerhq.hu