|
3 | 3 | * Copyright (C) 2014-2021 Paul Cercueil <paul@crapouillou.net> |
4 | 4 | */ |
5 | 5 |
|
| 6 | +#include "arch.h" |
6 | 7 | #include "blockcache.h" |
7 | 8 | #include "debug.h" |
8 | 9 | #include "disassembler.h" |
@@ -103,7 +104,7 @@ static void lightrec_emit_end_of_block(struct lightrec_cstate *state, |
103 | 104 |
|
104 | 105 | if (cycles && update_cycles) { |
105 | 106 | jit_subi(LIGHTREC_REG_CYCLE, LIGHTREC_REG_CYCLE, cycles); |
106 | | -pr_debug("EOB: %u cycles\n", cycles); |
| 107 | +pr_debug("EOB: %"PRIu32" cycles\n", cycles); |
107 | 108 | } |
108 | 109 |
|
109 | 110 | if (has_ds && op_flag_load_delay(ds->flags) |
@@ -247,11 +248,11 @@ static void rec_b(struct lightrec_cstate *state, const struct block *block, u16 |
247 | 248 | struct lightrec_branch *branch; |
248 | 249 | const struct opcode *op = &block->opcode_list[offset], |
249 | 250 | *ds = get_delay_slot(block->opcode_list, offset); |
250 | | -jit_node_t *addr; |
251 | 251 | bool is_forward = (s16)op->i.imm >= 0; |
252 | 252 | int op_cycles = lightrec_cycles_of_opcode(state->state, op->c); |
253 | 253 | u32 target_offset, cycles = state->cycles + op_cycles; |
254 | 254 | bool no_indirection = false; |
| 255 | +jit_node_t *addr = NULL; |
255 | 256 | u32 next_pc; |
256 | 257 | u8 rs, rt; |
257 | 258 |
|
@@ -308,7 +309,7 @@ static void rec_b(struct lightrec_cstate *state, const struct block *block, u16 |
308 | 309 |
|
309 | 310 | target_offset = offset + 1 + (s16)op->i.imm |
310 | 311 | - !!op_flag_no_ds(op->flags); |
311 | | -pr_debug("Adding local branch to offset 0x%x\n", |
| 312 | +pr_debug("Adding local branch to offset 0x%"PRIx32"\n", |
312 | 313 | target_offset << 2); |
313 | 314 | branch = &state->local_branches[ |
314 | 315 | state->nb_local_branches++]; |
@@ -941,7 +942,7 @@ static void rec_alu_mult(struct lightrec_cstate *state, |
941 | 942 | u8 reg_lo = get_mult_div_lo(c); |
942 | 943 | u8 reg_hi = get_mult_div_hi(c); |
943 | 944 | jit_state_t *_jit = block->_jit; |
944 | | -u8 lo, hi, rs, rt, rflags = 0; |
| 945 | +u8 lo, hi = 0, rs, rt, rflags = 0; |
945 | 946 | bool no_lo = op_flag_no_lo(flags); |
946 | 947 | bool no_hi = op_flag_no_hi(flags); |
947 | 948 |
|
@@ -1276,10 +1277,16 @@ static void rec_and_mask(struct lightrec_cstate *cstate, |
1276 | 1277 | struct regcache *reg_cache = cstate->reg_cache; |
1277 | 1278 | u8 reg_imm; |
1278 | 1279 |
|
1279 | | -reg_imm = lightrec_alloc_reg_temp_with_value(reg_cache, _jit, mask); |
1280 | | -jit_andr(reg_out, reg_in, reg_imm); |
| 1280 | +if (arch_has_fast_mask() |
| 1281 | + && (is_low_mask(mask) || is_high_mask(mask))) { |
| 1282 | +jit_andi(reg_out, reg_in, mask); |
| 1283 | +} else { |
| 1284 | +reg_imm = lightrec_alloc_reg_temp_with_value(reg_cache, _jit, |
| 1285 | + mask); |
| 1286 | +jit_andr(reg_out, reg_in, reg_imm); |
1281 | 1287 |
|
1282 | | -lightrec_free_reg(reg_cache, reg_imm); |
| 1288 | +lightrec_free_reg(reg_cache, reg_imm); |
| 1289 | +} |
1283 | 1290 | } |
1284 | 1291 |
|
1285 | 1292 | static void rec_store_memory(struct lightrec_cstate *cstate, |
|
0 commit comments