[Bug other/80492] [5/6/7 Regression] Wrong code when unrolling a loop with inline asm and local regs
gjl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Apr 24 14:36:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80492
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|avr |avr,x86,x86_64
Summary|[5/6 Regression] Wrong code |[5/6/7 Regression] Wrong
|when unrolling a loop with |code when unrolling a loop
|inline asm and local regs |with inline asm and local
| |regs
--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Also occurs for x68 and x86_64:
static __inline__ __attribute__((__always_inline__))
void syscall_7 (int val)
{
register int reg __asm ("4") = val;
__asm __volatile__ ("/* Some Code %0 */" :: "r" (reg));
}
void do_syscalls (void)
{
for (int s = 0; s < 2; s++)
{
syscall_7 (0);
syscall_7 (1);
}
}
$ gcc -S -O2 -dp -v ...
Configured with: ../../gcc.gnu.org/gcc-7-branch/configure
--prefix=/local/gnu/install/gcc-7-host --enable-languages=c,c++
--enable-checking=release --disable-bootstrap
Thread model: posix
gcc version 7.0.1 20170424 (prerelease) (GCC)
GNU C11 (GCC) version 7.0.1 20170424 (prerelease) (x86_64-pc-linux-gnu)
compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR
version 3.1.4, MPC version 1.0.3, isl version isl-0.16.1-GMP
Generated asm:
do_syscalls:
.LFB1:
.cfi_startproc
xorl %esi, %esi # 20 *movdi_xor [length = 2]
#APP
# 5 "sys.c" 1
/* Some Code %esi */
# 0 "" 2
#NO_APP
movl $1, %esi # 7 *movsi_internal/1 [length = 5]
#APP
# 5 "sys.c" 1
/* Some Code %esi */
# 0 "" 2
# 5 "sys.c" 1
/* Some Code %esi */
# 0 "" 2
# 5 "sys.c" 1
/* Some Code %esi */
# 0 "" 2
#NO_APP
ret # 16 simple_return_internal [length = 1]
The 2 last inline asms are missing the set of ESI.
More information about the Gcc-bugs
mailing list