mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
py: Implement and,or,xor native ops for viper.
This commit is contained in:
30
py/asmarm.c
30
py/asmarm.c
@@ -175,6 +175,21 @@ STATIC uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
|
||||
return 0x0400000 | (rn << 16) | (rd << 12) | rm;
|
||||
}
|
||||
|
||||
STATIC uint asm_arm_op_and_reg(uint rd, uint rn, uint rm) {
|
||||
// and rd, rn, rm
|
||||
return 0x0000000 | (rn << 16) | (rd << 12) | rm;
|
||||
}
|
||||
|
||||
STATIC uint asm_arm_op_eor_reg(uint rd, uint rn, uint rm) {
|
||||
// eor rd, rn, rm
|
||||
return 0x0200000 | (rn << 16) | (rd << 12) | rm;
|
||||
}
|
||||
|
||||
STATIC uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
|
||||
// orr rd, rn, rm
|
||||
return 0x1800000 | (rn << 16) | (rd << 12) | rm;
|
||||
}
|
||||
|
||||
void asm_arm_bkpt(asm_arm_t *as) {
|
||||
// bkpt #0
|
||||
emit_al(as, 0x1200070);
|
||||
@@ -312,6 +327,21 @@ void asm_arm_sub_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
|
||||
emit_al(as, asm_arm_op_sub_reg(rd, rn, rm));
|
||||
}
|
||||
|
||||
void asm_arm_and_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
|
||||
// and rd, rn, rm
|
||||
emit_al(as, asm_arm_op_and_reg(rd, rn, rm));
|
||||
}
|
||||
|
||||
void asm_arm_eor_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
|
||||
// eor rd, rn, rm
|
||||
emit_al(as, asm_arm_op_eor_reg(rd, rn, rm));
|
||||
}
|
||||
|
||||
void asm_arm_orr_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
|
||||
// orr rd, rn, rm
|
||||
emit_al(as, asm_arm_op_orr_reg(rd, rn, rm));
|
||||
}
|
||||
|
||||
void asm_arm_mov_reg_local_addr(asm_arm_t *as, uint rd, int local_num) {
|
||||
// add rd, sp, #local_num*4
|
||||
emit_al(as, asm_arm_op_add_imm(rd, ASM_ARM_REG_SP, local_num << 2));
|
||||
|
||||
Reference in New Issue
Block a user