[PATCH] Use call-clobbered register for sibcall via GOT
From: H.J. Lu <hongjiu.lu@intel.com>
Since sibcall never returns, we can only use call-clobbered register as
GOT base. Otherwise, callee-saved register used as GOT base won't be
properly restored. sibcall_memory_operand is changed to allow 32-bit
GOT slot only with pseudo register as GOT base for RTL expansion. 2
new patterns, *sibcall_GOT_32 and *sibcall_value_GOT_32, are added to
expose GOT base register to register allocator so that call-clobbered
register will be used for GOT base.
gcc/
PR target/68937
* config/i386/i386.c (ix86_function_ok_for_sibcall): Count
call to global function via GOT slot as indirect call.
* config/i386/i386.md (*sibcall_GOT_32): New pattern.
(*sibcall_value_GOT_32): Likewise.
* config/i386/predicates.md (sibcall_memory_operand): Rewrite.
Allow 32-bit GOT slot only with pseudo register as GOT base.
(GOT32_symbol_operand): New predicate.
gcc/testsuite/
PR target/68937
* gcc.target/i386/pr68937-1.c: New test.
* gcc.target/i386/pr68937-2.c: Likewise.
* gcc.target/i386/pr68937-3.c: Likewise.
* gcc.target/i386/pr68937-4.c: Likewise.
* gcc.target/i386/pr68937-5.c: Likewise.
* gcc.target/i386/pr68937-6.c: Likewise.
From-SVN: r231903