summaryrefslogtreecommitdiff
path: root/libavcodec/mips/sbrdsp_mips.c
diff options
context:
space:
mode:
authorJames Cowgill <james410@cowgill.org.uk>2015-03-05 17:40:15 +0000
committerMichael Niedermayer <michaelni@gmx.at>2015-03-06 14:37:44 +0100
commit157d6f0d5b95261bf053566d8a1c2652387da30c (patch)
treeca481834165a1f3c103eea9dc50fd5e877bbcbde /libavcodec/mips/sbrdsp_mips.c
parenteae13eae9d6499e81cd77bcd9e13f7bcb31b5577 (diff)
mips: port optimizations to mips n64
This mainly consists of replacing all the pointer arithmatic 'addiu' instructions with PTR_ADDIU which will handle the differences in pointer sizes when compiled on 64 bit mips systems. The header asmdefs.h contains the PTR_ macros which expend to the correct mips instructions to manipulate registers containing pointers. Signed-off-by: James Cowgill <james410@cowgill.org.uk> Reviewed-by: Nedeljko Babic <Nedeljko.Babic@imgtec.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mips/sbrdsp_mips.c')
-rw-r--r--libavcodec/mips/sbrdsp_mips.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/libavcodec/mips/sbrdsp_mips.c b/libavcodec/mips/sbrdsp_mips.c
index 000d3b5f49..c203095548 100644
--- a/libavcodec/mips/sbrdsp_mips.c
+++ b/libavcodec/mips/sbrdsp_mips.c
@@ -56,6 +56,7 @@
#include "config.h"
#include "libavcodec/sbrdsp.h"
+#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM
static void sbr_qmf_pre_shuffle_mips(float *z)
@@ -80,7 +81,7 @@ static void sbr_qmf_pre_shuffle_mips(float *z)
"xor %[Temp3], %[Temp3], %[Temp6] \n\t"
"xor %[Temp4], %[Temp4], %[Temp6] \n\t"
"xor %[Temp5], %[Temp5], %[Temp6] \n\t"
- "addiu %[z2], %[z2], -20 \n\t"
+ PTR_ADDIU "%[z2], %[z2], -20 \n\t"
"sw %[Temp1], 32(%[z1]) \n\t"
"sw %[Temp2], 24(%[z1]) \n\t"
"sw %[Temp3], 16(%[z1]) \n\t"
@@ -96,8 +97,8 @@ static void sbr_qmf_pre_shuffle_mips(float *z)
"sw %[Temp3], 20(%[z1]) \n\t"
"sw %[Temp4], 28(%[z1]) \n\t"
"sw %[Temp5], 36(%[z1]) \n\t"
- "addiu %[z3], %[z3], 20 \n\t"
- "addiu %[z1], %[z1], 40 \n\t"
+ PTR_ADDIU "%[z3], %[z3], 20 \n\t"
+ PTR_ADDIU "%[z1], %[z1], 40 \n\t"
"bne %[z1], %[z4], 1b \n\t"
"lw %[Temp1], 132(%[z]) \n\t"
"lw %[Temp2], 128(%[z]) \n\t"
@@ -138,7 +139,7 @@ static void sbr_qmf_post_shuffle_mips(float W[32][2], const float *z)
"xor %[Temp2], %[Temp2], %[Temp5] \n\t"
"xor %[Temp3], %[Temp3], %[Temp5] \n\t"
"xor %[Temp4], %[Temp4], %[Temp5] \n\t"
- "addiu %[z2], %[z2], -16 \n\t"
+ PTR_ADDIU "%[z2], %[z2], -16 \n\t"
"sw %[Temp1], 24(%[W_ptr]) \n\t"
"sw %[Temp2], 16(%[W_ptr]) \n\t"
"sw %[Temp3], 8(%[W_ptr]) \n\t"
@@ -151,8 +152,8 @@ static void sbr_qmf_post_shuffle_mips(float W[32][2], const float *z)
"sw %[Temp2], 12(%[W_ptr]) \n\t"
"sw %[Temp3], 20(%[W_ptr]) \n\t"
"sw %[Temp4], 28(%[W_ptr]) \n\t"
- "addiu %[z1], %[z1], 16 \n\t"
- "addiu %[W_ptr], %[W_ptr], 32 \n\t"
+ PTR_ADDIU "%[z1], %[z1], 16 \n\t"
+ PTR_ADDIU "%[W_ptr],%[W_ptr], 32 \n\t"
"bne %[z1], %[z_end], 1b \n\t"
: [Temp1]"=&r"(Temp1), [Temp2]"=&r"(Temp2),
@@ -286,7 +287,7 @@ static float sbr_sum_square_mips(float (*x)[2], int n)
"lwc1 %[temp2], 8(%[p_x]) \n\t"
"lwc1 %[temp3], 12(%[p_x]) \n\t"
"1: \n\t"
- "addiu %[p_x], %[p_x], 16 \n\t"
+ PTR_ADDIU "%[p_x], %[p_x], 16 \n\t"
"madd.s %[sum0], %[sum0], %[temp0], %[temp0] \n\t"
"lwc1 %[temp0], 0(%[p_x]) \n\t"
"madd.s %[sum1], %[sum1], %[temp1], %[temp1] \n\t"
@@ -421,10 +422,10 @@ static void sbr_qmf_deint_bfly_mips(float *v, const float *src0, const float *sr
"swc1 %[temp6], 56(%[v0]) \n\t"
"swc1 %[temp11], -60(%[v1]) \n\t"
"swc1 %[temp9], 60(%[v0]) \n\t"
- "addiu %[src0], %[src0], 64 \n\t"
- "addiu %[src1], %[src1], -64 \n\t"
- "addiu %[v0], %[v0], 64 \n\t"
- "addiu %[v1], %[v1], -64 \n\t"
+ PTR_ADDIU " %[src0], %[src0], 64 \n\t"
+ PTR_ADDIU " %[src1], %[src1], -64 \n\t"
+ PTR_ADDIU " %[v0], %[v0], 64 \n\t"
+ PTR_ADDIU " %[v1], %[v1], -64 \n\t"
: [v0]"+r"(v0), [v1]"+r"(v1), [src0]"+r"(psrc0), [src1]"+r"(psrc1),
[temp0]"=&f"(temp0), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2),
@@ -473,7 +474,7 @@ static void sbr_autocorrelate_mips(const float x[40][2], float phi[3][2][2])
"add.s %[imag_sum_1], %[imag_sum_1], %[temp_r2] \n\t"
"add.s %[real_sum_2], %[real_sum_2], %[temp_r3] \n\t"
"add.s %[imag_sum_2], %[imag_sum_2], %[temp_r4] \n\t"
- "addiu %[p_x], %[p_x], 8 \n\t"
+ PTR_ADDIU "%[p_x], %[p_x], 8 \n\t"
: [temp0]"=&f"(temp0), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2),
[temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5),
@@ -543,7 +544,7 @@ static void sbr_autocorrelate_mips(const float x[40][2], float phi[3][2][2])
"add.s %[imag_sum_1], %[imag_sum_1], %[temp_r2] \n\t"
"add.s %[real_sum_2], %[real_sum_2], %[temp_r3] \n\t"
"add.s %[imag_sum_2], %[imag_sum_2], %[temp_r4] \n\t"
- "addiu %[p_x], %[p_x], 24 \n\t"
+ PTR_ADDIU "%[p_x], %[p_x], 24 \n\t"
: [temp0]"=&f"(temp0), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2),
[temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5),
@@ -634,8 +635,8 @@ static void sbr_hf_gen_mips(float (*X_high)[2], const float (*X_low)[2],
"lwc1 %[temp8], 4(%[alpha]) \n\t"
"lwc1 %[temp9], 8(%[alpha]) \n\t"
"lwc1 %[temp10], 12(%[alpha]) \n\t"
- "addiu %[p_x_high], %[p_x_high], 8 \n\t"
- "addiu %[p_x_low], %[p_x_low], 8 \n\t"
+ PTR_ADDIU "%[p_x_high], %[p_x_high], 8 \n\t"
+ PTR_ADDIU "%[p_x_low], %[p_x_low], 8 \n\t"
"mul.s %[temp11], %[temp1], %[temp8] \n\t"
"msub.s %[temp11], %[temp11], %[temp0], %[temp7] \n\t"
"madd.s %[temp11], %[temp11], %[temp2], %[temp9] \n\t"
@@ -682,12 +683,12 @@ static void sbr_hf_g_filt_mips(float (*Y)[2], const float (*X_high)[40][2],
"lwc1 %[temp2], 4(%[p_x]) \n\t"
"mul.s %[temp1], %[temp1], %[temp0] \n\t"
"mul.s %[temp2], %[temp2], %[temp0] \n\t"
- "addiu %[p_g], %[p_g], 4 \n\t"
- "addiu %[p_x], %[p_x], 320 \n\t"
+ PTR_ADDIU "%[p_g], %[p_g], 4 \n\t"
+ PTR_ADDIU "%[p_x], %[p_x], 320 \n\t"
"swc1 %[temp1], 0(%[p_y]) \n\t"
"swc1 %[temp2], 4(%[p_y]) \n\t"
"bne %[p_g], %[loop_end], 1b \n\t"
- " addiu %[p_y], %[p_y], 8 \n\t"
+ PTR_ADDIU "%[p_y], %[p_y], 8 \n\t"
".set pop \n\t"
: [temp0]"=&f"(temp0), [temp1]"=&f"(temp1),
@@ -719,7 +720,7 @@ static void sbr_hf_apply_noise_0_mips(float (*Y)[2], const float *s_m,
"addiu %[noise], %[noise], 1 \n\t"
"andi %[noise], %[noise], 0x1ff \n\t"
"sll %[temp0], %[noise], 3 \n\t"
- "addu %[ff_table], %[ff_sbr_noise_table], %[temp0] \n\t"
+ PTR_ADDU "%[ff_table],%[ff_sbr_noise_table], %[temp0] \n\t"
"add.s %[y0], %[y0], %[temp1] \n\t"
"mfc1 %[temp3], %[temp1] \n\t"
"bne %[temp3], $0, 1f \n\t"
@@ -765,7 +766,7 @@ static void sbr_hf_apply_noise_1_mips(float (*Y)[2], const float *s_m,
"addiu %[noise], %[noise], 1 \n\t"
"andi %[noise], %[noise], 0x1ff \n\t"
"sll %[temp0], %[noise], 3 \n\t"
- "addu %[ff_table], %[ff_sbr_noise_table], %[temp0] \n\t"
+ PTR_ADDU "%[ff_table],%[ff_sbr_noise_table],%[temp0] \n\t"
"madd.s %[y1], %[y1], %[temp1], %[phi_sign] \n\t"
"bne %[temp3], $0, 1f \n\t"
"lwc1 %[y0], 0(%[Y1]) \n\t"
@@ -810,7 +811,7 @@ static void sbr_hf_apply_noise_2_mips(float (*Y)[2], const float *s_m,
"addiu %[noise], %[noise], 1 \n\t"
"andi %[noise], %[noise], 0x1ff \n\t"
"sll %[temp0], %[noise], 3 \n\t"
- "addu %[ff_table], %[ff_sbr_noise_table], %[temp0] \n\t"
+ PTR_ADDU "%[ff_table],%[ff_sbr_noise_table],%[temp0] \n\t"
"sub.s %[y0], %[y0], %[temp1] \n\t"
"mfc1 %[temp3], %[temp1] \n\t"
"bne %[temp3], $0, 1f \n\t"
@@ -856,7 +857,7 @@ static void sbr_hf_apply_noise_3_mips(float (*Y)[2], const float *s_m,
"addiu %[noise], %[noise], 1 \n\t"
"andi %[noise], %[noise], 0x1ff \n\t"
"sll %[temp0], %[noise], 3 \n\t"
- "addu %[ff_table], %[ff_sbr_noise_table], %[temp0] \n\t"
+ PTR_ADDU "%[ff_table],%[ff_sbr_noise_table], %[temp0] \n\t"
"nmsub.s %[y1], %[y1], %[temp1], %[phi_sign] \n\t"
"mfc1 %[temp3], %[temp1] \n\t"
"bne %[temp3], $0, 1f \n\t"