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.