[Bug target/111235] [Armv7-a]: Control-dependency between atomic accesses removed by -O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111235 Sam James changed: What|Removed |Added Target Milestone|--- |14.0
[Bug target/111235] [Armv7-a]: Control-dependency between atomic accesses removed by -O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111235 Wilco changed: What|Removed |Added Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #6 from Wilco --- Fixed
[Bug target/111235] [Armv7-a]: Control-dependency between atomic accesses removed by -O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111235 --- Comment #5 from Luke Geeson --- Thank you for fixing this, Wilco! I will now test this bug using the code emitted by Godbolt. Consider again the same source program. When run through gcc with the same flags we get the ARM assembly test: ``` ARM test { [P0_r0]=0;[P1_r0]=0;[x]=0;[y]=0; %P0_P0_r0=P0_r0;%P0_x=x;%P0_y=y; %P1_P1_r0=P1_r0;%P1_x=x;%P1_y=y } (*) (* the Telechat toolsuite*) (* *) (* Luke Geeson, University College London, UK. *) (* gcc -O1 -march=armv7-a -pthread --std=c11 -marm -fno-section-anchors*) (* *) (*) P0 | P1 ; LDR R2,[%P0_x] | LDR R2,[%P1_y] ; CMP R2,#1 | DMB ISH ; BEQ L3 | MOV R1,#1 ; L2: STR R2, [%P0_P0_r0]| STR R1, [%P1_x] ; BX LR | STR R2, [%P1_P1_r0] ; L3: MOV R1, #1 | ; STR R1, [%P0_y] | ; B L2| ; exists (P0_r0=1 /\ P1_r0=1) ``` Which under the arm model has the outcomes: ``` [P0_r0]=0; [P1_r0]=0; [P0_r0]=1; [P1_r0]=0; ``` As you can see the buggy behaviour has gone away, the bug is fixed.
[Bug target/111235] [Armv7-a]: Control-dependency between atomic accesses removed by -O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111235 --- Comment #4 from Luke Geeson --- Hi there, Apologies here you go: https://github.com/llvm/llvm-project/issues/65106
[Bug target/111235] [Armv7-a]: Control-dependency between atomic accesses removed by -O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111235 Sam James changed: What|Removed |Added CC||sjames at gcc dot gnu.org --- Comment #3 from Sam James --- (In reply to Luke Geeson from comment #1) > Correction > We will follow up by reporting the bug for GCC. > -> > We have reported this in LLVM as well Could you include the link? Thanks.
[Bug target/111235] [Armv7-a]: Control-dependency between atomic accesses removed by -O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111235 --- Comment #2 from CVS Commits --- The master branch has been updated by Wilco Dijkstra : https://gcc.gnu.org/g:0731889c026bfe8d55c4851422ca5ec9d037f7a0 commit r14-4365-g0731889c026bfe8d55c4851422ca5ec9d037f7a0 Author: Wilco Dijkstra Date: Fri Sep 29 13:21:10 2023 +0100 Arm: Block predication on atomics [PR111235] The v7 memory ordering model allows reordering of conditional atomic instructions. To avoid this, make all atomic patterns unconditional. Expand atomic loads and stores for all architectures so the memory access can be wrapped into an UNSPEC. Reviewed-by: Ramana Radhakrishnan gcc/ChangeLog: PR target/111235 * config/arm/constraints.md: Remove Pf constraint. * config/arm/sync.md (arm_atomic_load): Add new pattern. (arm_atomic_load_acquire): Likewise. (arm_atomic_store): Likewise. (arm_atomic_store_release): Likewise. (atomic_load): Switch patterns to define_expand. (atomic_store): Likewise. (arm_atomic_loaddi2_ldrd): Remove predication. (arm_load_exclusive): Likewise. (arm_load_acquire_exclusive): Likewise. (arm_load_exclusivesi): Likewise. (arm_load_acquire_exclusivesi): Likewise. (arm_load_exclusivedi): Likewise. (arm_load_acquire_exclusivedi): Likewise. (arm_store_exclusive): Likewise. (arm_store_release_exclusivedi): Likewise. (arm_store_release_exclusive): Likewise. * config/arm/unspecs.md: Add VUNSPEC_LDR and VUNSPEC_STR. gcc/testsuite/ChangeLog: PR target/111235 * gcc.dg/rtl/arm/stl-cond.c: Remove test. * gcc.target/arm/atomic_loaddi_7.c: Fix dmb count. * gcc.target/arm/atomic_loaddi_8.c: Likewise. * gcc.target/arm/pr111235.c: Add new test.