mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
Hexagon (target/hexagon) Reduce manipulation of slot_cancelled
We only need to track slot for predicated stores and predicated HVX instructions. Add arguments to the probe helper functions to indicate if the slot is predicated. Here is a simple example of the differences in the TCG code generated: IN: 0x00400094: 0xf900c102 { if (P0) R2 = and(R0,R1) } BEFORE ---- 00400094 mov_i32 slot_cancelled,$0x0 mov_i32 new_r2,r2 and_i32 tmp0,p0,$0x1 brcond_i32 tmp0,$0x0,eq,$L1 and_i32 tmp0,r0,r1 mov_i32 new_r2,tmp0 br $L2 set_label $L1 or_i32 slot_cancelled,slot_cancelled,$0x8 set_label $L2 mov_i32 r2,new_r2 AFTER ---- 00400094 mov_i32 new_r2,r2 and_i32 tmp0,p0,$0x1 brcond_i32 tmp0,$0x0,eq,$L1 and_i32 tmp0,r0,r1 mov_i32 new_r2,tmp0 br $L2 set_label $L1 set_label $L2 mov_i32 r2,new_r2 Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Anton Johansson <anjo@rev.ng> Message-Id: <20230307025828.1612809-14-tsimpson@quicinc.com>
This commit is contained in:
parent
e28b77a6b4
commit
7b84fd04bd
8 changed files with 71 additions and 30 deletions
|
@ -248,7 +248,16 @@ static bool check_for_attrib(Packet *pkt, int attrib)
|
|||
|
||||
static bool need_slot_cancelled(Packet *pkt)
|
||||
{
|
||||
return check_for_attrib(pkt, A_CONDEXEC);
|
||||
/* We only need slot_cancelled for conditional store and HVX instructions */
|
||||
for (int i = 0; i < pkt->num_insns; i++) {
|
||||
uint16_t opcode = pkt->insn[i].opcode;
|
||||
if (GET_ATTRIB(opcode, A_CONDEXEC) &&
|
||||
(GET_ATTRIB(opcode, A_STORE) ||
|
||||
GET_ATTRIB(opcode, A_CVI))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool need_pred_written(Packet *pkt)
|
||||
|
@ -845,13 +854,27 @@ static void gen_commit_packet(DisasContext *ctx)
|
|||
TCGv mask_tcgv;
|
||||
|
||||
if (has_store_s0) {
|
||||
mask |= (1 << 0);
|
||||
mask =
|
||||
FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_ST0, 1);
|
||||
}
|
||||
if (has_store_s1) {
|
||||
mask |= (1 << 1);
|
||||
mask =
|
||||
FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_ST1, 1);
|
||||
}
|
||||
if (has_hvx_store) {
|
||||
mask |= (1 << 2);
|
||||
mask =
|
||||
FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES,
|
||||
HAS_HVX_STORES, 1);
|
||||
}
|
||||
if (has_store_s0 && slot_is_predicated(pkt, 0)) {
|
||||
mask =
|
||||
FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES,
|
||||
S0_IS_PRED, 1);
|
||||
}
|
||||
if (has_store_s1 && slot_is_predicated(pkt, 1)) {
|
||||
mask =
|
||||
FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES,
|
||||
S1_IS_PRED, 1);
|
||||
}
|
||||
mask_tcgv = tcg_constant_tl(mask);
|
||||
gen_helper_probe_pkt_scalar_hvx_stores(cpu_env, mask_tcgv, mem_idx);
|
||||
|
@ -861,8 +884,15 @@ static void gen_commit_packet(DisasContext *ctx)
|
|||
* process_store_log will execute the slot 1 store first,
|
||||
* so we only have to probe the store in slot 0
|
||||
*/
|
||||
TCGv mem_idx = tcg_constant_tl(ctx->mem_idx);
|
||||
gen_helper_probe_pkt_scalar_store_s0(cpu_env, mem_idx);
|
||||
int args = 0;
|
||||
args =
|
||||
FIELD_DP32(args, PROBE_PKT_SCALAR_STORE_S0, MMU_IDX, ctx->mem_idx);
|
||||
if (slot_is_predicated(pkt, 0)) {
|
||||
args =
|
||||
FIELD_DP32(args, PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED, 1);
|
||||
}
|
||||
TCGv args_tcgv = tcg_constant_tl(args);
|
||||
gen_helper_probe_pkt_scalar_store_s0(cpu_env, args_tcgv);
|
||||
}
|
||||
|
||||
process_store_log(ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue