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 | 6314 | case FOP(18, 16): |
| 6315 | 6315 | { |
| 6316 | 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 | 6318 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 6319 | 6319 | |
| 6320 | 6320 | gen_load_gpr(t0, ft); |
| 6321 | 6321 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); |
| 6322 | - tcg_temp_free(t0); | |
| 6323 | 6322 | gen_load_fpr32(fp0, fs); |
| 6324 | 6323 | gen_store_fpr32(fp0, fd); |
| 6325 | 6324 | tcg_temp_free(fp0); |
| 6326 | 6325 | gen_set_label(l1); |
| 6326 | + tcg_temp_free(t0); | |
| 6327 | 6327 | } |
| 6328 | 6328 | opn = "movz.s"; |
| 6329 | 6329 | break; |
| 6330 | 6330 | case FOP(19, 16): |
| 6331 | 6331 | { |
| 6332 | 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 | 6334 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 6335 | 6335 | |
| 6336 | 6336 | gen_load_gpr(t0, ft); |
| 6337 | 6337 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); |
| 6338 | - tcg_temp_free(t0); | |
| 6339 | 6338 | gen_load_fpr32(fp0, fs); |
| 6340 | 6339 | gen_store_fpr32(fp0, fd); |
| 6341 | 6340 | tcg_temp_free(fp0); |
| 6342 | 6341 | gen_set_label(l1); |
| 6342 | + tcg_temp_free(t0); | |
| 6343 | 6343 | } |
| 6344 | 6344 | opn = "movn.s"; |
| 6345 | 6345 | break; |
| ... | ... | @@ -6733,32 +6733,32 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, |
| 6733 | 6733 | case FOP(18, 17): |
| 6734 | 6734 | { |
| 6735 | 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 | 6737 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I64); |
| 6738 | 6738 | |
| 6739 | 6739 | gen_load_gpr(t0, ft); |
| 6740 | 6740 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); |
| 6741 | - tcg_temp_free(t0); | |
| 6742 | 6741 | gen_load_fpr64(ctx, fp0, fs); |
| 6743 | 6742 | gen_store_fpr64(ctx, fp0, fd); |
| 6744 | 6743 | tcg_temp_free(fp0); |
| 6745 | 6744 | gen_set_label(l1); |
| 6745 | + tcg_temp_free(t0); | |
| 6746 | 6746 | } |
| 6747 | 6747 | opn = "movz.d"; |
| 6748 | 6748 | break; |
| 6749 | 6749 | case FOP(19, 17): |
| 6750 | 6750 | { |
| 6751 | 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 | 6753 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I64); |
| 6754 | 6754 | |
| 6755 | 6755 | gen_load_gpr(t0, ft); |
| 6756 | 6756 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); |
| 6757 | - tcg_temp_free(t0); | |
| 6758 | 6757 | gen_load_fpr64(ctx, fp0, fs); |
| 6759 | 6758 | gen_store_fpr64(ctx, fp0, fd); |
| 6760 | 6759 | tcg_temp_free(fp0); |
| 6761 | 6760 | gen_set_label(l1); |
| 6761 | + tcg_temp_free(t0); | |
| 6762 | 6762 | } |
| 6763 | 6763 | opn = "movn.d"; |
| 6764 | 6764 | break; |
| ... | ... | @@ -7068,13 +7068,12 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, |
| 7068 | 7068 | check_cp1_64bitmode(ctx); |
| 7069 | 7069 | { |
| 7070 | 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 | 7072 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7073 | 7073 | TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7074 | 7074 | |
| 7075 | 7075 | gen_load_gpr(t0, ft); |
| 7076 | 7076 | tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0, l1); |
| 7077 | - tcg_temp_free(t0); | |
| 7078 | 7077 | gen_load_fpr32(fp0, fs); |
| 7079 | 7078 | gen_load_fpr32h(fph0, fs); |
| 7080 | 7079 | gen_store_fpr32(fp0, fd); |
| ... | ... | @@ -7082,6 +7081,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, |
| 7082 | 7081 | tcg_temp_free(fp0); |
| 7083 | 7082 | tcg_temp_free(fph0); |
| 7084 | 7083 | gen_set_label(l1); |
| 7084 | + tcg_temp_free(t0); | |
| 7085 | 7085 | } |
| 7086 | 7086 | opn = "movz.ps"; |
| 7087 | 7087 | break; |
| ... | ... | @@ -7089,13 +7089,12 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, |
| 7089 | 7089 | check_cp1_64bitmode(ctx); |
| 7090 | 7090 | { |
| 7091 | 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 | 7093 | TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7094 | 7094 | TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32); |
| 7095 | 7095 | |
| 7096 | 7096 | gen_load_gpr(t0, ft); |
| 7097 | 7097 | tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); |
| 7098 | - tcg_temp_free(t0); | |
| 7099 | 7098 | gen_load_fpr32(fp0, fs); |
| 7100 | 7099 | gen_load_fpr32h(fph0, fs); |
| 7101 | 7100 | gen_store_fpr32(fp0, fd); |
| ... | ... | @@ -7103,6 +7102,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, |
| 7103 | 7102 | tcg_temp_free(fp0); |
| 7104 | 7103 | tcg_temp_free(fph0); |
| 7105 | 7104 | gen_set_label(l1); |
| 7105 | + tcg_temp_free(t0); | |
| 7106 | 7106 | } |
| 7107 | 7107 | opn = "movn.ps"; |
| 7108 | 7108 | break; | ... | ... |