ARC: workaround bloated structure access in ASM with _st_huge_offset

When we accessing bloated structure member we can exceed u9 operand
in store instruction. So we can use _st32_huge_offset macro instead
for 32 bit accesses

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
Evgeniy Paltsev 2021-04-07 22:27:42 +03:00 committed by Kumar Gala
commit 9d309d300a
3 changed files with 15 additions and 3 deletions

View file

@ -264,7 +264,7 @@ SECTION_FUNC(TEXT, _rirq_exit)
/* r2 is old thread */
_irq_store_old_thread_callee_regs
st _CAUSE_RIRQ, [r2, _thread_offset_to_relinquish_cause]
_st32_huge_offset _CAUSE_RIRQ, r2, _thread_offset_to_relinquish_cause, r2
/* mov new thread (r0) to r2 */
MOVR r2, r0

View file

@ -63,8 +63,7 @@ SECTION_FUNC(TEXT, z_arc_switch)
SUBR r2, r1, ___thread_t_switch_handle_OFFSET
st _CAUSE_COOP, [r2, _thread_offset_to_relinquish_cause]
_st32_huge_offset _CAUSE_COOP, r2, _thread_offset_to_relinquish_cause, r3
/*
* Save status32 and blink on the stack before the callee-saved registers.

View file

@ -521,6 +521,19 @@
#endif
.endm
/*
* When we accessing bloated struct member we can exceed u9 operand in store
* instruction. So we can use _st32_huge_offset macro instead
*/
.macro _st32_huge_offset, d, s, off, temp
.if MACRO_ARG(off) > 255 || MACRO_ARG(off) < -256
ADDR MACRO_ARG(temp), MACRO_ARG(s), MACRO_ARG(off)
st MACRO_ARG(d), [MACRO_ARG(temp)]
.else
st MACRO_ARG(d), [MACRO_ARG(s), MACRO_ARG(off)]
.endif
.endm
#endif /* _ASMLANGUAGE */
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_SWAP_MACROS_H_ */