# # You can avoid this patch if you install latest openbsi that have emulation for fence.tso # --- llvm-13.0.0.src/lib/Target/RISCV/RISCVInstrInfo.td.orig 2022-01-15 10:16:23.130143948 +0100 +++ llvm-13.0.0.src/lib/Target/RISCV/RISCVInstrInfo.td 2022-01-15 10:12:12.226066736 +0100 @@ -1148,7 +1148,9 @@ // fence release -> fence rw, w def : Pat<(atomic_fence (XLenVT 5), (timm)), (FENCE 0b11, 0b1)>; // fence acq_rel -> fence.tso -def : Pat<(atomic_fence (XLenVT 6), (timm)), (FENCE_TSO)>; +// AllWinner D1 (rv64imafdc) does not have fence.tso +//def : Pat<(atomic_fence (XLenVT 6), (timm)), (FENCE_TSO)>; +def : Pat<(atomic_fence (XLenVT 6), (timm)), (FENCE 0b11, 0b11)>; // fence seq_cst -> fence rw, rw def : Pat<(atomic_fence (XLenVT 7), (timm)), (FENCE 0b11, 0b11)>; --- llvm-17.0.0.src/test/CodeGen/RISCV/atomic-fence.ll.orig 2023-09-19 11:05:13.000000000 +0200 +++ llvm-17.0.0.src/test/CodeGen/RISCV/atomic-fence.ll 2023-09-30 10:17:42.929574930 +0200 @@ -43,7 +43,7 @@ define void @fence_acq_rel() nounwind { ; WMO-LABEL: fence_acq_rel: ; WMO: # %bb.0: -; WMO-NEXT: fence.tso +; WMO-NEXT: fence rw, rw ; WMO-NEXT: ret ; ; TSO-LABEL: fence_acq_rel: