Commit 2a0ab9989938b8d633be12e2614a45806daac927
1 parent
b10fa3c9
target-mips: optimize gen_farith()
Optimize code generation in gen_farith(): - Temp variables are valid up to and *including* the brcond instruction. Use them instead of temp local variables. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5682 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
12 additions
and
12 deletions
target-mips/translate.c
| @@ -6314,32 +6314,32 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -6314,32 +6314,32 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
| 6314 | case FOP(18, 16): | 6314 | case FOP(18, 16): |
| 6315 | { | 6315 | { |
| 6316 | int l1 = gen_new_label(); | 6316 | int l1 = gen_new_label(); |
| 6317 | - TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); | 6317 | + TCGv t0 = tcg_temp_new(TCG_TYPE_TL); |
| 6318 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); | 6318 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 6319 | 6319 | ||
| 6320 | gen_load_gpr(t0, ft); | 6320 | gen_load_gpr(t0, ft); |
| 6321 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); | 6321 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); |
| 6322 | - tcg_temp_free(t0); | ||
| 6323 | gen_load_fpr32(fp0, fs); | 6322 | gen_load_fpr32(fp0, fs); |
| 6324 | gen_store_fpr32(fp0, fd); | 6323 | gen_store_fpr32(fp0, fd); |
| 6325 | tcg_temp_free(fp0); | 6324 | tcg_temp_free(fp0); |
| 6326 | gen_set_label(l1); | 6325 | gen_set_label(l1); |
| 6326 | + tcg_temp_free(t0); | ||
| 6327 | } | 6327 | } |
| 6328 | opn = "movz.s"; | 6328 | opn = "movz.s"; |
| 6329 | break; | 6329 | break; |
| 6330 | case FOP(19, 16): | 6330 | case FOP(19, 16): |
| 6331 | { | 6331 | { |
| 6332 | int l1 = gen_new_label(); | 6332 | int l1 = gen_new_label(); |
| 6333 | - TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); | 6333 | + TCGv t0 = tcg_temp_new(TCG_TYPE_TL); |
| 6334 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); | 6334 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 6335 | 6335 | ||
| 6336 | gen_load_gpr(t0, ft); | 6336 | gen_load_gpr(t0, ft); |
| 6337 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); | 6337 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); |
| 6338 | - tcg_temp_free(t0); | ||
| 6339 | gen_load_fpr32(fp0, fs); | 6338 | gen_load_fpr32(fp0, fs); |
| 6340 | gen_store_fpr32(fp0, fd); | 6339 | gen_store_fpr32(fp0, fd); |
| 6341 | tcg_temp_free(fp0); | 6340 | tcg_temp_free(fp0); |
| 6342 | gen_set_label(l1); | 6341 | gen_set_label(l1); |
| 6342 | + tcg_temp_free(t0); | ||
| 6343 | } | 6343 | } |
| 6344 | opn = "movn.s"; | 6344 | opn = "movn.s"; |
| 6345 | break; | 6345 | break; |
| @@ -6733,32 +6733,32 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -6733,32 +6733,32 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
| 6733 | case FOP(18, 17): | 6733 | case FOP(18, 17): |
| 6734 | { | 6734 | { |
| 6735 | int l1 = gen_new_label(); | 6735 | int l1 = gen_new_label(); |
| 6736 | - TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); | 6736 | + TCGv t0 = tcg_temp_new(TCG_TYPE_TL); |
| 6737 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I64); | 6737 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I64); |
| 6738 | 6738 | ||
| 6739 | gen_load_gpr(t0, ft); | 6739 | gen_load_gpr(t0, ft); |
| 6740 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); | 6740 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); |
| 6741 | - tcg_temp_free(t0); | ||
| 6742 | gen_load_fpr64(ctx, fp0, fs); | 6741 | gen_load_fpr64(ctx, fp0, fs); |
| 6743 | gen_store_fpr64(ctx, fp0, fd); | 6742 | gen_store_fpr64(ctx, fp0, fd); |
| 6744 | tcg_temp_free(fp0); | 6743 | tcg_temp_free(fp0); |
| 6745 | gen_set_label(l1); | 6744 | gen_set_label(l1); |
| 6745 | + tcg_temp_free(t0); | ||
| 6746 | } | 6746 | } |
| 6747 | opn = "movz.d"; | 6747 | opn = "movz.d"; |
| 6748 | break; | 6748 | break; |
| 6749 | case FOP(19, 17): | 6749 | case FOP(19, 17): |
| 6750 | { | 6750 | { |
| 6751 | int l1 = gen_new_label(); | 6751 | int l1 = gen_new_label(); |
| 6752 | - TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); | 6752 | + TCGv t0 = tcg_temp_new(TCG_TYPE_TL); |
| 6753 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I64); | 6753 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I64); |
| 6754 | 6754 | ||
| 6755 | gen_load_gpr(t0, ft); | 6755 | gen_load_gpr(t0, ft); |
| 6756 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); | 6756 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); |
| 6757 | - tcg_temp_free(t0); | ||
| 6758 | gen_load_fpr64(ctx, fp0, fs); | 6757 | gen_load_fpr64(ctx, fp0, fs); |
| 6759 | gen_store_fpr64(ctx, fp0, fd); | 6758 | gen_store_fpr64(ctx, fp0, fd); |
| 6760 | tcg_temp_free(fp0); | 6759 | tcg_temp_free(fp0); |
| 6761 | gen_set_label(l1); | 6760 | gen_set_label(l1); |
| 6761 | + tcg_temp_free(t0); | ||
| 6762 | } | 6762 | } |
| 6763 | opn = "movn.d"; | 6763 | opn = "movn.d"; |
| 6764 | break; | 6764 | break; |
| @@ -7068,13 +7068,12 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -7068,13 +7068,12 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
| 7068 | check_cp1_64bitmode(ctx); | 7068 | check_cp1_64bitmode(ctx); |
| 7069 | { | 7069 | { |
| 7070 | int l1 = gen_new_label(); | 7070 | int l1 = gen_new_label(); |
| 7071 | - TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); | 7071 | + TCGv t0 = tcg_temp_new(TCG_TYPE_TL); |
| 7072 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); | 7072 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7073 | TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32); | 7073 | TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7074 | 7074 | ||
| 7075 | gen_load_gpr(t0, ft); | 7075 | gen_load_gpr(t0, ft); |
| 7076 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); | 7076 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); |
| 7077 | - tcg_temp_free(t0); | ||
| 7078 | gen_load_fpr32(fp0, fs); | 7077 | gen_load_fpr32(fp0, fs); |
| 7079 | gen_load_fpr32h(fph0, fs); | 7078 | gen_load_fpr32h(fph0, fs); |
| 7080 | gen_store_fpr32(fp0, fd); | 7079 | gen_store_fpr32(fp0, fd); |
| @@ -7082,6 +7081,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -7082,6 +7081,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
| 7082 | tcg_temp_free(fp0); | 7081 | tcg_temp_free(fp0); |
| 7083 | tcg_temp_free(fph0); | 7082 | tcg_temp_free(fph0); |
| 7084 | gen_set_label(l1); | 7083 | gen_set_label(l1); |
| 7084 | + tcg_temp_free(t0); | ||
| 7085 | } | 7085 | } |
| 7086 | opn = "movz.ps"; | 7086 | opn = "movz.ps"; |
| 7087 | break; | 7087 | break; |
| @@ -7089,13 +7089,12 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -7089,13 +7089,12 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
| 7089 | check_cp1_64bitmode(ctx); | 7089 | check_cp1_64bitmode(ctx); |
| 7090 | { | 7090 | { |
| 7091 | int l1 = gen_new_label(); | 7091 | int l1 = gen_new_label(); |
| 7092 | - TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); | 7092 | + TCGv t0 = tcg_temp_new(TCG_TYPE_TL); |
| 7093 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); | 7093 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7094 | TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32); | 7094 | TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7095 | 7095 | ||
| 7096 | gen_load_gpr(t0, ft); | 7096 | gen_load_gpr(t0, ft); |
| 7097 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); | 7097 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); |
| 7098 | - tcg_temp_free(t0); | ||
| 7099 | gen_load_fpr32(fp0, fs); | 7098 | gen_load_fpr32(fp0, fs); |
| 7100 | gen_load_fpr32h(fph0, fs); | 7099 | gen_load_fpr32h(fph0, fs); |
| 7101 | gen_store_fpr32(fp0, fd); | 7100 | gen_store_fpr32(fp0, fd); |
| @@ -7103,6 +7102,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | @@ -7103,6 +7102,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, | ||
| 7103 | tcg_temp_free(fp0); | 7102 | tcg_temp_free(fp0); |
| 7104 | tcg_temp_free(fph0); | 7103 | tcg_temp_free(fph0); |
| 7105 | gen_set_label(l1); | 7104 | gen_set_label(l1); |
| 7105 | + tcg_temp_free(t0); | ||
| 7106 | } | 7106 | } |
| 7107 | opn = "movn.ps"; | 7107 | opn = "movn.ps"; |
| 7108 | break; | 7108 | break; |