On Fri, Jan 6, 2023 at 6:55 PM Takayuki 'January June' Suwa <jjsuwa_sys3...@yahoo.co.jp> wrote: > > This patch introduces a convenient helper function for integer immediate > addition with scratch register as needed, that splits and emits either > up to two ADDI/ADDMI machine instructions or an addition by register > following an integer immediate load (which may later be transformed by > constantsynth). > > By using the helper function, it makes stack frame adjustment logic > simplified and instruction count less in some cases. > > gcc/ChangeLog: > > * config/xtensa/xtensa.cc > (xtensa_split_imm_two_addends, xtensa_emit_add_imm): > New helper functions. > (xtensa_set_return_address, xtensa_output_mi_thunk): > Change to use the helper function. > (xtensa_emit_adjust_stack_ptr): Ditto. > And also change to try reusing the content of scratch register > A9 if the register is not modified in the function body. > --- > gcc/config/xtensa/xtensa.cc | 151 +++++++++++++++++++++++++----------- > 1 file changed, 106 insertions(+), 45 deletions(-)
Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max