Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
794df0f1
Commit
794df0f1
authored
Jan 17, 2021
by
graham sanderson
Committed by
Damien George
Jan 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py/emitnative: Support binary ops on ARMv6M without use of ite instr.
parent
15ac5a3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
py/asmthumb.c
py/asmthumb.c
+12
-0
py/asmthumb.h
py/asmthumb.h
+2
-0
py/emitnative.c
py/emitnative.c
+23
-0
No files found.
py/asmthumb.c
View file @
794df0f1
...
...
@@ -564,6 +564,18 @@ void asm_thumb_bcc_label(asm_thumb_t *as, int cond, uint label) {
}
}
void
asm_thumb_bcc_rel9
(
asm_thumb_t
*
as
,
int
cond
,
int
rel
)
{
rel
-=
4
;
// account for instruction prefetch, PC is 4 bytes ahead of this instruction
assert
(
SIGNED_FIT9
(
rel
));
asm_thumb_op16
(
as
,
OP_BCC_N
(
cond
,
rel
));
}
void
asm_thumb_b_rel12
(
asm_thumb_t
*
as
,
int
rel
)
{
rel
-=
4
;
// account for instruction prefetch, PC is 4 bytes ahead of this instruction
assert
(
SIGNED_FIT12
(
rel
));
asm_thumb_op16
(
as
,
OP_B_N
(
rel
));
}
#define OP_BLX(reg) (0x4780 | ((reg) << 3))
#define OP_SVC(arg) (0xdf00 | (arg))
...
...
py/asmthumb.h
View file @
794df0f1
...
...
@@ -330,6 +330,8 @@ void asm_thumb_ldr_reg_reg_i12_optimised(asm_thumb_t *as, uint reg_dest, uint re
void
asm_thumb_b_label
(
asm_thumb_t
*
as
,
uint
label
);
// convenience: picks narrow or wide branch
void
asm_thumb_bcc_label
(
asm_thumb_t
*
as
,
int
cc
,
uint
label
);
// convenience: picks narrow or wide branch
void
asm_thumb_bl_ind
(
asm_thumb_t
*
as
,
uint
fun_id
,
uint
reg_temp
);
// convenience
void
asm_thumb_bcc_rel9
(
asm_thumb_t
*
as
,
int
cc
,
int
rel
);
void
asm_thumb_b_rel12
(
asm_thumb_t
*
as
,
int
rel
);
// Holds a pointer to mp_fun_table
#define ASM_THUMB_REG_FUN_TABLE ASM_THUMB_REG_R7
...
...
py/emitnative.c
View file @
794df0f1
...
...
@@ -2454,6 +2454,7 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
asm_x86_setcc_r8
(
emit
->
as
,
ops
[
op_idx
],
REG_RET
);
#elif N_THUMB
asm_thumb_cmp_rlo_rlo
(
emit
->
as
,
REG_ARG_2
,
reg_rhs
);
#if MICROPY_EMIT_THUMB_ARMV7M
static
uint16_t
ops
[
6
+
6
]
=
{
// unsigned
ASM_THUMB_OP_ITE_CC
,
...
...
@@ -2473,6 +2474,28 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
asm_thumb_op16
(
emit
->
as
,
ops
[
op_idx
]);
asm_thumb_mov_rlo_i8
(
emit
->
as
,
REG_RET
,
1
);
asm_thumb_mov_rlo_i8
(
emit
->
as
,
REG_RET
,
0
);
#else
static
uint16_t
ops
[
6
+
6
]
=
{
// unsigned
ASM_THUMB_CC_CC
,
ASM_THUMB_CC_HI
,
ASM_THUMB_CC_EQ
,
ASM_THUMB_CC_LS
,
ASM_THUMB_CC_CS
,
ASM_THUMB_CC_NE
,
// signed
ASM_THUMB_CC_LT
,
ASM_THUMB_CC_GT
,
ASM_THUMB_CC_EQ
,
ASM_THUMB_CC_LE
,
ASM_THUMB_CC_GE
,
ASM_THUMB_CC_NE
,
};
asm_thumb_bcc_rel9
(
emit
->
as
,
ops
[
op_idx
],
6
);
asm_thumb_mov_rlo_i8
(
emit
->
as
,
REG_RET
,
0
);
asm_thumb_b_rel12
(
emit
->
as
,
4
);
asm_thumb_mov_rlo_i8
(
emit
->
as
,
REG_RET
,
1
);
#endif
#elif N_ARM
asm_arm_cmp_reg_reg
(
emit
->
as
,
REG_ARG_2
,
reg_rhs
);
static
uint
ccs
[
6
+
6
]
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment