kopia lustrzana https://github.com/micropython/micropython
py/asmxtensa: Optimise asm_xtensa_mov_reg_i32_optimised() for tiny ints.
Signed-off-by: Damien George <damien@micropython.org>pull/14119/head
rodzic
f52b0d0ff1
commit
b50efbd0e3
|
@ -185,7 +185,9 @@ size_t asm_xtensa_mov_reg_i32(asm_xtensa_t *as, uint reg_dest, uint32_t i32) {
|
|||
}
|
||||
|
||||
void asm_xtensa_mov_reg_i32_optimised(asm_xtensa_t *as, uint reg_dest, uint32_t i32) {
|
||||
if (SIGNED_FIT12(i32)) {
|
||||
if (-32 <= (int)i32 && (int)i32 <= 95) {
|
||||
asm_xtensa_op_movi_n(as, reg_dest, i32);
|
||||
} else if (SIGNED_FIT12(i32)) {
|
||||
asm_xtensa_op_movi(as, reg_dest, i32);
|
||||
} else {
|
||||
asm_xtensa_mov_reg_i32(as, reg_dest, i32);
|
||||
|
|
|
@ -203,8 +203,9 @@ static inline void asm_xtensa_op_movi(asm_xtensa_t *as, uint reg_dest, int32_t i
|
|||
asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 10, (imm12 >> 8) & 0xf, reg_dest, imm12 & 0xff));
|
||||
}
|
||||
|
||||
static inline void asm_xtensa_op_movi_n(asm_xtensa_t *as, uint reg_dest, int imm4) {
|
||||
asm_xtensa_op16(as, ASM_XTENSA_ENCODE_RI7(12, reg_dest, imm4));
|
||||
// Argument must be in the range (-32 .. 95) inclusive.
|
||||
static inline void asm_xtensa_op_movi_n(asm_xtensa_t *as, uint reg_dest, int imm7) {
|
||||
asm_xtensa_op16(as, ASM_XTENSA_ENCODE_RI7(12, reg_dest, imm7));
|
||||
}
|
||||
|
||||
static inline void asm_xtensa_op_mull(asm_xtensa_t *as, uint reg_dest, uint reg_src_a, uint reg_src_b) {
|
||||
|
|
Ładowanie…
Reference in New Issue