Commit 0cfe58cd4470cfbbd3650ec9451cdd0b0e3058c0

Authored by aurel32
1 parent fea0c503

target-ppc: simplify slw, srw, sld, srd

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5597 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 12 deletions
target-ppc/translate.c
@@ -1959,12 +1959,11 @@ GEN_HANDLER(slw, 0x1F, 0x18, 0x00, 0x00000000, PPC_INTEGER) @@ -1959,12 +1959,11 @@ GEN_HANDLER(slw, 0x1F, 0x18, 0x00, 0x00000000, PPC_INTEGER)
1959 l2 = gen_new_label(); 1959 l2 = gen_new_label();
1960 1960
1961 t0 = tcg_temp_local_new(TCG_TYPE_TL); 1961 t0 = tcg_temp_local_new(TCG_TYPE_TL);
1962 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x20);  
1963 - tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); 1962 + tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x3f);
  1963 + tcg_gen_brcondi_tl(TCG_COND_LT, t0, 0x20, l1);
1964 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0); 1964 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0);
1965 tcg_gen_br(l2); 1965 tcg_gen_br(l2);
1966 gen_set_label(l1); 1966 gen_set_label(l1);
1967 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x3f);  
1968 tcg_gen_shl_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], t0); 1967 tcg_gen_shl_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], t0);
1969 tcg_gen_ext32u_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); 1968 tcg_gen_ext32u_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
1970 gen_set_label(l2); 1969 gen_set_label(l2);
@@ -2018,12 +2017,11 @@ GEN_HANDLER(srw, 0x1F, 0x18, 0x10, 0x00000000, PPC_INTEGER) @@ -2018,12 +2017,11 @@ GEN_HANDLER(srw, 0x1F, 0x18, 0x10, 0x00000000, PPC_INTEGER)
2018 l2 = gen_new_label(); 2017 l2 = gen_new_label();
2019 2018
2020 t0 = tcg_temp_local_new(TCG_TYPE_TL); 2019 t0 = tcg_temp_local_new(TCG_TYPE_TL);
2021 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x20);  
2022 - tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); 2020 + tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x3f);
  2021 + tcg_gen_brcondi_tl(TCG_COND_LT, t0, 0x20, l1);
2023 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0); 2022 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0);
2024 tcg_gen_br(l2); 2023 tcg_gen_br(l2);
2025 gen_set_label(l1); 2024 gen_set_label(l1);
2026 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x3f);  
2027 t1 = tcg_temp_new(TCG_TYPE_TL); 2025 t1 = tcg_temp_new(TCG_TYPE_TL);
2028 tcg_gen_ext32u_tl(t1, cpu_gpr[rS(ctx->opcode)]); 2026 tcg_gen_ext32u_tl(t1, cpu_gpr[rS(ctx->opcode)]);
2029 tcg_gen_shr_tl(cpu_gpr[rA(ctx->opcode)], t1, t0); 2027 tcg_gen_shr_tl(cpu_gpr[rA(ctx->opcode)], t1, t0);
@@ -2043,12 +2041,11 @@ GEN_HANDLER(sld, 0x1F, 0x1B, 0x00, 0x00000000, PPC_64B) @@ -2043,12 +2041,11 @@ GEN_HANDLER(sld, 0x1F, 0x1B, 0x00, 0x00000000, PPC_64B)
2043 l2 = gen_new_label(); 2041 l2 = gen_new_label();
2044 2042
2045 t0 = tcg_temp_local_new(TCG_TYPE_TL); 2043 t0 = tcg_temp_local_new(TCG_TYPE_TL);
2046 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x40);  
2047 - tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); 2044 + tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x7f);
  2045 + tcg_gen_brcondi_tl(TCG_COND_LT, t0, 0x40, l1);
2048 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0); 2046 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0);
2049 tcg_gen_br(l2); 2047 tcg_gen_br(l2);
2050 gen_set_label(l1); 2048 gen_set_label(l1);
2051 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x7f);  
2052 tcg_gen_shl_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], t0); 2049 tcg_gen_shl_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], t0);
2053 gen_set_label(l2); 2050 gen_set_label(l2);
2054 tcg_temp_free(t0); 2051 tcg_temp_free(t0);
@@ -2106,12 +2103,11 @@ GEN_HANDLER(srd, 0x1F, 0x1B, 0x10, 0x00000000, PPC_64B) @@ -2106,12 +2103,11 @@ GEN_HANDLER(srd, 0x1F, 0x1B, 0x10, 0x00000000, PPC_64B)
2106 l2 = gen_new_label(); 2103 l2 = gen_new_label();
2107 2104
2108 t0 = tcg_temp_local_new(TCG_TYPE_TL); 2105 t0 = tcg_temp_local_new(TCG_TYPE_TL);
2109 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x40);  
2110 - tcg_gen_brcondi_tl(TCG_COND_EQ, t0, 0, l1); 2106 + tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x7f);
  2107 + tcg_gen_brcondi_tl(TCG_COND_LT, t0, 0x40, l1);
2111 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0); 2108 tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0);
2112 tcg_gen_br(l2); 2109 tcg_gen_br(l2);
2113 gen_set_label(l1); 2110 gen_set_label(l1);
2114 - tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x7f);  
2115 tcg_gen_shr_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], t0); 2111 tcg_gen_shr_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], t0);
2116 gen_set_label(l2); 2112 gen_set_label(l2);
2117 tcg_temp_free(t0); 2113 tcg_temp_free(t0);