diff options
author | Hongyu Wang <hongyu.wang@intel.com> | 2021-11-18 14:45:23 +0800 |
---|---|---|
committer | Hongyu Wang <hongyu.wang@intel.com> | 2021-11-18 16:29:19 +0800 |
commit | 15f5e70cbb33b40c97325ef9d55557747a148d39 (patch) | |
tree | 1df1020b51e959c0aa2de8fea18561d3a6161780 /gcc/function.c | |
parent | 17da2c7425ea1f5bf417b954f444dbe1f1618a1c (diff) | |
download | gcc-15f5e70cbb33b40c97325ef9d55557747a148d39.zip gcc-15f5e70cbb33b40c97325ef9d55557747a148d39.tar.gz gcc-15f5e70cbb33b40c97325ef9d55557747a148d39.tar.bz2 |
i386: Fix wrong codegen for -mrelax-cmpxchg-loop
For -mrelax-cmpxchg-loop introduced by PR 103069/r12-5265, it would
produce infinite loop. The correct code should be
.L84:
movl (%rdi), %ecx
movl %eax, %edx
orl %esi, %edx
cmpl %eax, %ecx
jne .L82
lock cmpxchgl %edx, (%rdi)
jne .L84
movl %r8d, %eax <<< retval is missing in previous impl
ret
.L82:
rep nop
jmp .L84
Adjust corresponding expander to fix such issue, and fix runtime test
so the problem would be exposed.
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_expand_atomic_fetch_op_loop):
Adjust generated cfg to avoid infinite loop.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr103069-2.c: Adjust.
Diffstat (limited to 'gcc/function.c')
0 files changed, 0 insertions, 0 deletions