Skip to content

Commit 522f25e

Browse files
committed
i386: Fix infinite loop under -mrelax-cmpxchg-loop [PR 103069]
For -mrelax-cmpxchg-loop which relaxes atomic_fetch_<logic> loops, there is a missing set to %eax when compare fails, which would result in infinite loop in some benchmark. Add set to %eax to avoid it. gcc/ChangeLog: PR target/103069 * config/i386/i386-expand.cc (ix86_expand_cmpxchg_loop): Add missing set to target_val at pause label.
1 parent 41f8f8b commit 522f25e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

gcc/config/i386/i386-expand.cc

+1
Original file line numberDiff line numberDiff line change
@@ -23405,6 +23405,7 @@ ix86_expand_cmpxchg_loop (rtx *ptarget_bool, rtx target_val,
2340523405

2340623406
/* If mem is not expected, pause and loop back. */
2340723407
emit_label (cmp_label);
23408+
emit_move_insn (target_val, new_mem);
2340823409
emit_insn (gen_pause ());
2340923410
emit_jump_insn (gen_jump (loop_label));
2341023411
emit_barrier ();

0 commit comments

Comments
 (0)