aboutsummaryrefslogtreecommitdiff
path: root/py/asmarm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-06-04 14:00:29 +0000
committerDamien George <damien.p.george@gmail.com>2015-06-04 14:00:29 +0000
commit567b349c2b271c0f04add0f1beb36495835f66f8 (patch)
treeeec69f15a26a3eef7a057c8075f23bb514362d5d /py/asmarm.c
parent4d9cad180dbaf25cdbb9dd0c54a637483db933a7 (diff)
py: Implement native multiply operation in viper emitter.
Diffstat (limited to 'py/asmarm.c')
-rw-r--r--py/asmarm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/py/asmarm.c b/py/asmarm.c
index 2f7556f16..2c389ac8c 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -179,6 +179,12 @@ 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_mul_reg(uint rd, uint rm, uint rs) {
+ // mul rd, rm, rs
+ assert(rd != rm);
+ return 0x0000090 | (rd << 16) | (rs << 8) | 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;
@@ -340,6 +346,12 @@ 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_mul_reg_reg_reg(asm_arm_t *as, uint rd, uint rs, uint rm) {
+ // rs and rm are swapped because of restriction rd!=rm
+ // mul rd, rm, rs
+ emit_al(as, asm_arm_op_mul_reg(rd, rm, rs));
+}
+
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));