https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127244
--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> --- Created attachment 65591 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65591&action=edit Minimized testcase 2 A slightly different testcase for x86_64-linux-gnu (reduced from native_save_fl()/write_cpu_inactive() in arch/x86/include/asm/irqflags.h) calling: void __wrgsbase_inactive(unsigned long); instead of unsigned long __rdgsbase_inactive(void); Patched gcc -O2 now produces: 11: 9c pushf 12: 58 pop %rax 13: 48 89 c3 mov %rax,%rbx <----- *** here *** 16: fa cli 17: e8 00 00 00 00 call 1c <x86_gsbase_write_cpu_inactive+0x1c> 18: R_X86_64_PLT32 __wrgsbase_inactive-0x4 1c: 80 e7 02 and $0x2,%bh 1f: 74 01 je 22 <x86_gsbase_write_cpu_inactive+0x22> 21: fb sti where intermediate %rax register is not needed at all.
