qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v4 09/12] target/hexagon: import lexer for idef-parser


From: Taylor Simpson
Subject: RE: [PATCH v4 09/12] target/hexagon: import lexer for idef-parser
Date: Tue, 27 Apr 2021 02:01:13 +0000


> -----Original Message-----
> From: Alessandro Di Federico <ale.qemu@rev.ng>
> Sent: Thursday, April 15, 2021 11:35 AM
> To: qemu-devel@nongnu.org
> Cc: Taylor Simpson <tsimpson@quicinc.com>; Brian Cain
> <bcain@quicinc.com>; babush@rev.ng; nizzo@rev.ng; philmd@redhat.com;
> richard.henderson@linaro.org; Alessandro Di Federico <ale@rev.ng>
> Subject: [PATCH v4 09/12] target/hexagon: import lexer for idef-parser

> +/**
> + * Semantic record of the IMM token, identifying an immediate constant
> + */
> +typedef struct HexImm {
> +    union {
> +        char id;            /**< Identifier of the immediate                 
> */
> +        uint64_t value;     /**< Immediate value (for VALUE type immediates) 
> */

Most immediates are 32 bits.  Since you treat them as 64 bits, you end up with 
unnecessary extends and truncates in the TCG.

Here's an example from idef-generated-emitter.c
void emit_J2_jump(DisasContext *ctx, Insn *insn, Packet *pkt, int riV)
/* fIMMEXT(riV); (riV = riV & ~3); (PC = fREAD_PC()+riV);} */
{
int64_t qemu_tmp_0 = ~((int64_t)3ULL);
int32_t qemu_tmp_1 = riV & qemu_tmp_0;
riV = qemu_tmp_1;
TCGv_i32 tmp_0 = tcg_temp_local_new_i32();
tcg_gen_movi_i32(tmp_0, ctx->base.pc_next);
TCGv_i64 tmp_1 = tcg_temp_local_new_i64();
tcg_gen_ext_i32_i64(tmp_1, tmp_0);                                          <- 
Don't need this extension
tcg_temp_free_i32(tmp_0);
TCGv_i64 tmp_2 = tcg_temp_local_new_i64();
tcg_gen_addi_i64(tmp_2, tmp_1, (int64_t)riV);                        <- This 
should be 32 bits
tcg_temp_free_i64(tmp_1);
TCGv_i32 tmp_3 = tcg_temp_local_new_i32();
tcg_gen_trunc_i64_tl(tmp_3, tmp_2);                                         <- 
Don't need this truncation
tcg_temp_free_i64(tmp_2);
gen_write_new_pc(tmp_3);
tcg_temp_free_i32(tmp_3);
}

> +        uint64_t index;     /**< Index of the immediate (for int temp vars)  
> */
> +    };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]