]> git.ipfire.org Git - thirdparty/gcc.git/commit
[APX] Support Intel APX PUSH2POP2
authorMo, Zewei <zewei.mo@intel.com>
Mon, 6 Mar 2023 02:42:32 +0000 (10:42 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Thu, 12 Oct 2023 03:28:57 +0000 (11:28 +0800)
commit180b08f64408be598b33b8830c52336abcb0c68a
tree02f4e6b581f3191c9f7ad982bbc004372f61c4f9
parentd6b7fe11efe9c7bf44dfe57ded6c86df5ec7e2c7
[APX] Support Intel APX PUSH2POP2

This feature requires stack to be aligned at 16byte, therefore in
prologue/epilogue, a standalone push/pop will be emitted before any
push2/pop2 if the stack was not aligned to 16byte.
Also for current implementation we only support push2/pop2 usage in
function prologue/epilogue for those callee-saved registers.

gcc/ChangeLog:

* config/i386/i386.cc (gen_push2): New function to emit push2
and adjust cfa offset.
(ix86_pro_and_epilogue_can_use_push2_pop2): New function to
determine whether push2/pop2 can be used.
(ix86_compute_frame_layout): Adjust preferred stack boundary
and stack alignment needed for push2/pop2.
(ix86_emit_save_regs): Emit push2 when available.
(ix86_emit_restore_reg_using_pop2): New function to emit pop2
and adjust cfa info.
(ix86_emit_restore_regs_using_pop2): New function to loop
through the saved regs and call above.
(ix86_expand_epilogue): Call ix86_emit_restore_regs_using_pop2
when push2pop2 available.
* config/i386/i386.md (push2_di): New pattern for push2.
(pop2_di): Likewise for pop2.

gcc/testsuite/ChangeLog:

* gcc.target/i386/apx-push2pop2-1.c: New test.
* gcc.target/i386/apx-push2pop2_force_drap-1.c: Likewise.
* gcc.target/i386/apx-push2pop2_interrupt-1.c: Likewise.

Co-authored-by: Hu Lin1 <lin1.hu@intel.com>
Co-authored-by: Hongyu Wang <hongyu.wang@intel.com>
gcc/config/i386/i386.cc
gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/apx-push2pop2_interrupt-1.c [new file with mode: 0644]