aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>2022-08-18 04:31:16 +0900
committerMax Filippov <jcmvbkbc@gmail.com>2022-08-17 17:45:48 -0700
commitdca74793cd42ce4c5319943a516cc5ea7265b6f7 (patch)
treea26b28c43f824b234f51c8ec3e57296a37c6de91 /libcpp
parent0342f034adc677aa93e9a4587eb0b1e9dff9eab7 (diff)
downloadgcc-dca74793cd42ce4c5319943a516cc5ea7265b6f7.zip
gcc-dca74793cd42ce4c5319943a516cc5ea7265b6f7.tar.gz
gcc-dca74793cd42ce4c5319943a516cc5ea7265b6f7.tar.bz2
xtensa: Optimize stack pointer updates in function pro/epilogue under certain conditions
This patch enforces the use of "addmi" machine instruction instead of addition/subtraction with two source registers for adjusting the stack pointer, if the adjustment fits into a signed 16-bit and is also a multiple of 256. /* example */ void test(void) { char buffer[4096]; __asm__(""::"m"(buffer)); } ;; before test: movi.n a9, 1 slli a9, a9, 12 sub sp, sp, a9 movi.n a9, 1 slli a9, a9, 12 add.n sp, sp, a9 addi sp, sp, 0 ret.n ;; after test: addmi sp, sp, -0x1000 addmi sp, sp, 0x1000 ret.n gcc/ChangeLog: * config/xtensa/xtensa.cc (xtensa_expand_prologue): Use an "addmi" machine instruction for updating the stack pointer rather than addition/subtraction via hard register A9, if the amount of change satisfies the literal value conditions of that instruction when the CALL0 ABI is used. (xtensa_expand_epilogue): Ditto. And also inhibit the stack pointer addition of constant zero.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions