[llvm] AtomicExpand: Allow incrementally legalizing atomicrmw (PR #103371)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 12:55:58 PDT 2024
================
@@ -128,46 +131,49 @@ define half @test_atomicrmw_fadd_f16_seq_cst_align4(ptr %ptr, half %value) #0 {
;
; SOFTFP-NOLSE-LABEL: test_atomicrmw_fadd_f16_seq_cst_align4:
; SOFTFP-NOLSE: // %bb.0:
-; SOFTFP-NOLSE-NEXT: stp x30, x23, [sp, #-48]! // 16-byte Folded Spill
+; SOFTFP-NOLSE-NEXT: str x30, [sp, #-48]! // 8-byte Folded Spill
; SOFTFP-NOLSE-NEXT: stp x20, x19, [sp, #32] // 16-byte Folded Spill
-; SOFTFP-NOLSE-NEXT: ldrh w20, [x0]
; SOFTFP-NOLSE-NEXT: mov x19, x0
+; SOFTFP-NOLSE-NEXT: ldrh w0, [x0]
+; SOFTFP-NOLSE-NEXT: mov w20, w1
; SOFTFP-NOLSE-NEXT: stp x22, x21, [sp, #16] // 16-byte Folded Spill
-; SOFTFP-NOLSE-NEXT: mov w21, w1
; SOFTFP-NOLSE-NEXT: b .LBB1_2
-; SOFTFP-NOLSE-NEXT: .LBB1_1: // %atomicrmw.start
+; SOFTFP-NOLSE-NEXT: .LBB1_1: // %cmpxchg.nostore
; SOFTFP-NOLSE-NEXT: // in Loop: Header=BB1_2 Depth=1
-; SOFTFP-NOLSE-NEXT: cmp w8, w23
-; SOFTFP-NOLSE-NEXT: mov w20, w8
-; SOFTFP-NOLSE-NEXT: b.eq .LBB1_5
+; SOFTFP-NOLSE-NEXT: mov w8, wzr
+; SOFTFP-NOLSE-NEXT: clrex
+; SOFTFP-NOLSE-NEXT: cbnz w8, .LBB1_6
----------------
efriedma-quic wrote:
"mov w8, wzr; cbnz w8, .LBB1_6" should just be an unconditional branch... might be a bit tricky to fix due to pass ordering? Should AtomicExpand or some other IR pass after it do some kind of CFG simplification?
I'm willing to just accept this as-is, and deal with it later if anyone cares, though.
https://github.com/llvm/llvm-project/pull/103371
More information about the llvm-commits
mailing list