diff options
author | Hongyu Wang <hongyu.wang@intel.com> | 2022-04-13 14:51:36 +0800 |
---|---|---|
committer | Hongyu Wang <hongyu.wang@intel.com> | 2022-04-13 16:17:27 +0800 |
commit | 522f25e90c781d284f8347a04940db8b41c42fd5 (patch) | |
tree | 3ae7f61f4cb464e533e678d0a3a0f68517d1681c /gcc | |
parent | 41f8f8b8a4ffcf28961cdc077fd7f0770f4bb7cc (diff) | |
download | gcc-522f25e90c781d284f8347a04940db8b41c42fd5.zip gcc-522f25e90c781d284f8347a04940db8b41c42fd5.tar.gz gcc-522f25e90c781d284f8347a04940db8b41c42fd5.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/i386/i386-expand.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 677059b..68978ef 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -23405,6 +23405,7 @@ ix86_expand_cmpxchg_loop (rtx *ptarget_bool, rtx target_val, /* If mem is not expected, pause and loop back. */ emit_label (cmp_label); + emit_move_insn (target_val, new_mem); emit_insn (gen_pause ()); emit_jump_insn (gen_jump (loop_label)); emit_barrier (); |