Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KbFzj-0007Tl-PM for qemu-devel@nongnu.org; Thu, 04 Sep 2008 10:39:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KbFzh-0007TR-3K for qemu-devel@nongnu.org; Thu, 04 Sep 2008 10:39:33 -0400 Received: from [199.232.76.173] (port=50420 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KbFzf-0007TK-Vw for qemu-devel@nongnu.org; Thu, 04 Sep 2008 10:39:32 -0400 Received: from hall.aurel32.net ([91.121.138.14]:60856) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KbFzf-0006YO-AT for qemu-devel@nongnu.org; Thu, 04 Sep 2008 10:39:32 -0400 Received: from junta-icatm144570-bada.red.retevision.es ([62.81.118.18] helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1KbFzY-00032Y-FS for qemu-devel@nongnu.org; Thu, 04 Sep 2008 16:39:24 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1KbFzV-0003oi-HF for qemu-devel@nongnu.org; Thu, 04 Sep 2008 16:39:21 +0200 Date: Thu, 4 Sep 2008 16:39:21 +0200 From: =?iso-8859-15?Q?Aur=E9lien?= Jarno Subject: Re: [Qemu-devel] [PATCH 6/x] ppc: Convert Altivec register moves to TCG Message-ID: <20080904143921.GB11924@volta.aurel32.net> References: <20080903050757.GX4681@volta.aurel32.net> <20080903112840.GC17474@networkno.de> <7F235F5C-A1C9-4617-8C8D-900778862BBD@web.de> <67BC3D0E-6819-426A-BD93-ADE75621E6E4@web.de> <3D7FC18B-1027-4AB9-ACDE-E7B650F259F2@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3D7FC18B-1027-4AB9-ACDE-E7B650F259F2@googlemail.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Thu, Sep 04, 2008 at 02:24:17PM +0200, Andreas Färber wrote: > Replace op_{load,store}_avr with helpers gen_{load,store}_avr. > Introduce two sets of i64 TCG variables, cpu_avr{h,l}[0..31], and > cpu_AVR{h,l}[0..2]. > > Signed-off-by: Andreas Faerber > > --- > In the future this might be improved with a > tcg_mem_alloc_new(TCG_TYPE_I128, ...) and corresponding move op on the > TCG side of things. But for now, handling it in the target cuts down > op_template.h to floating point and condition register moves. Applied, thanks. > Andreas > > target-ppc/op_template.h | 39 ----------------------------------- > target-ppc/translate.c | 50 +++++++++++++++++++++++++++++++++ > +------------ > 2 files changed, 37 insertions(+), 52 deletions(-) > > diff --git a/target-ppc/op_template.h b/target-ppc/op_template.h > index 8c65e49..64e38a9 100644 > --- a/target-ppc/op_template.h > +++ b/target-ppc/op_template.h > @@ -18,45 +18,6 @@ > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > USA > */ > > -/* Altivec registers moves */ > -void OPPROTO glue(op_load_avr_A0_avr, REG) (void) > -{ > - AVR0 = env->avr[REG]; > - RETURN(); > -} > - > -void OPPROTO glue(op_load_avr_A1_avr, REG) (void) > -{ > - AVR1 = env->avr[REG]; > - RETURN(); > -} > - > -void OPPROTO glue(op_load_avr_A2_avr, REG) (void) > -{ > - AVR2 = env->avr[REG]; > - RETURN(); > -} > - > -void OPPROTO glue(op_store_A0_avr_avr, REG) (void) > -{ > - env->avr[REG] = AVR0; > - RETURN(); > -} > - > -void OPPROTO glue(op_store_A1_avr_avr, REG) (void) > -{ > - env->avr[REG] = AVR1; > - RETURN(); > -} > - > -#if 0 // unused > -void OPPROTO glue(op_store_A2_avr_avr, REG) (void) > -{ > - env->avr[REG] = AVR2; > - RETURN(); > -} > -#endif > - > #if REG <= 7 > /* Condition register moves */ > void OPPROTO glue(op_load_crf_T0_crf, REG) (void) > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index ea51716..0674376 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -46,15 +46,16 @@ > > /* global register indexes */ > static TCGv cpu_env; > -static char cpu_reg_names[10*3 + 22*4 > +static char cpu_reg_names[10*3 + 22*4 /* GPR */ > #if !defined(TARGET_PPC64) > - + 10*4 + 22*5 > + + 10*4 + 22*5 /* SPE GPRh */ > #endif > -]; > + + 2*(10*6 + 22*7) /* AVRh, AVRl */]; > static TCGv cpu_gpr[32]; > #if !defined(TARGET_PPC64) > static TCGv cpu_gprh[32]; > #endif > +static TCGv cpu_avrh[32], cpu_avrl[32]; > > /* dyngen register indexes */ > static TCGv cpu_T[3]; > @@ -63,6 +64,7 @@ static TCGv cpu_T[3]; > #else > static TCGv cpu_T64[3]; > #endif > +static TCGv cpu_AVRh[3], cpu_AVRl[3]; > > #include "gen-icount.h" > > @@ -99,6 +101,18 @@ void ppc_translate_init(void) > TCG_AREG0, offsetof(CPUState, > t2_64), > "T2_64"); > #endif > + cpu_AVRh[0] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, avr0.u64[0]), > "AVR0H"); > + cpu_AVRl[0] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, avr0.u64[1]), > "AVR0L"); > + cpu_AVRh[1] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, avr1.u64[0]), > "AVR1H"); > + cpu_AVRl[1] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, avr1.u64[1]), > "AVR1L"); > + cpu_AVRh[2] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, avr2.u64[0]), > "AVR2H"); > + cpu_AVRl[2] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, avr2.u64[1]), > "AVR2L"); > > p = cpu_reg_names; > for (i = 0; i < 32; i++) { > @@ -112,6 +126,15 @@ void ppc_translate_init(void) > offsetof(CPUState, gprh[i]), > p); > p += (i < 10) ? 4 : 5; > #endif > + > + sprintf(p, "avr%dH", i); > + cpu_avrh[i] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, > avr[i].u64[0]), p); > + p += (i < 10) ? 6 : 7; > + sprintf(p, "avr%dL", i); > + cpu_avrl[i] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0, > + offsetof(CPUState, > avr[i].u64[1]), p); > + p += (i < 10) ? 6 : 7; > } > > /* register helpers */ > @@ -5241,15 +5264,16 @@ GEN_HANDLER2(icbt_440, "icbt", 0x1F, 0x16, 0x00, > 0x03E00001, PPC_BOOKE) > > /*** Altivec vector extension > ***/ > /* Altivec registers moves */ > -GEN32(gen_op_load_avr_A0, gen_op_load_avr_A0_avr); > -GEN32(gen_op_load_avr_A1, gen_op_load_avr_A1_avr); > -GEN32(gen_op_load_avr_A2, gen_op_load_avr_A2_avr); > > -GEN32(gen_op_store_A0_avr, gen_op_store_A0_avr_avr); > -GEN32(gen_op_store_A1_avr, gen_op_store_A1_avr_avr); > -#if 0 // unused > -GEN32(gen_op_store_A2_avr, gen_op_store_A2_avr_avr); > -#endif > +static always_inline void gen_load_avr(int t, int reg) { > + tcg_gen_mov_i64(cpu_AVRh[t], cpu_avrh[reg]); > + tcg_gen_mov_i64(cpu_AVRl[t], cpu_avrl[reg]); > +} > + > +static always_inline void gen_store_avr(int reg, int t) { > + tcg_gen_mov_i64(cpu_avrh[reg], cpu_AVRh[t]); > + tcg_gen_mov_i64(cpu_avrl[reg], cpu_AVRl[t]); > +} > > #define op_vr_ldst(name) (*gen_op_##name[ctx->mem_idx])() > #define OP_VR_LD_TABLE(name) > \ > @@ -5270,7 +5294,7 @@ GEN_HANDLER(l##name, 0x1F, opc2, opc3, 0x00000001, > PPC_ALTIVEC) \ > } \ > gen_addr_reg_index(ctx); > \ > op_vr_ldst(vr_l##name); > \ > - gen_op_store_A0_avr(rD(ctx->opcode)); > \ > + gen_store_avr(rD(ctx->opcode), 0); > \ > } > > #define GEN_VR_STX(name, opc2, opc3) > \ > @@ -5281,7 +5305,7 @@ GEN_HANDLER(st##name, 0x1F, opc2, opc3, > 0x00000001, PPC_ALTIVEC) \ > return; > \ > } \ > gen_addr_reg_index(ctx); > \ > - gen_op_load_avr_A0(rS(ctx->opcode)); > \ > + gen_load_avr(0, rS(ctx->opcode)); > \ > op_vr_ldst(vr_st##name); > \ > } > > -- > 1.5.5.1 > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net