On Wed, May 13, 2026 at 9:29 AM H.J. Lu <[email protected]> wrote: > > On Wed, May 13, 2026 at 1:50 PM Uros Bizjak <[email protected]> wrote: > > > > On Wed, May 13, 2026 at 12:00 AM H.J. Lu <[email protected]> wrote: > > > > > > In 64-bit mode, for preserve_none functions, DRAP may use any register > > > except AX, R12–R15, DI, SI (argument registers), SP, and BP. Use R11. > > > In non-callee-saved functions, R10 and R13 are also available since they > > > are not used for parameter passing. In 32-bit mode, preserve_none does > > > not affect parameter passing, so the current approach remains valid. > > > > > > DRAP register is used to restore stack pointer in epilogue for stack > > > realignment. Always save and restore DRAP register between prologue > > > and epilogue so that stack pointer can be restored. > > > > > > Tested on Linux/x86-64 and with CPython 3.14.4. > > > > > > gcc/ > > > > > > PR target/120870 > > > * config/i386/i386.cc (ix86_save_reg): Return true for DRAP > > > register early at entry. > > > (find_drap_reg): Use R11_REG in preserve_none functions in > > > 64-bit mode. > > > > > > gcc/testsuite/ > > > > > > PR target/120870 > > > * gcc.target/i386/pr120870-1.c: New test. > > > * gcc.target/i386/pr120870-2.c: Likewise. > > > > + > > +__attribute__ ((preserve_none)) void > > +tail (long a, long b) > > +{ > > +} > > > > This function doesn't need to be preserve_none, and the test will > > still fail with the unpatched compiler. > > > > OK with the above adjustion. > > Fixed. > > > Thanks, > > Uros. > > This is what I am checking in. OK to backport to GCC 16 branch > after a few days?
OK. Thanks, Uros.
