A question: is vld/vst guaranteed to be atomic if the accessed address is aligned? If true we can use them to implement lock-free 128-bit atomic load and store. See https://gcc.gnu.org/bugzilla/PR104688 for the background, and some people really hate using a lock for atomics.
On Fri, 2023-06-30 at 10:16 +0800, Chenghui Pan wrote: > These patches add the Loongson SX/ASX instruction support to the > LoongArch > target, and can be utilized by using the new "-mlsx" and > "-mlasx" option. > > Patches are bootstrapped and tested on loongarch64-linux-gnu target. > > Lulu Cheng (6): > LoongArch: Added Loongson SX vector directive compilation framework. > LoongArch: Added Loongson SX base instruction support. > LoongArch: Added Loongson SX directive builtin function support. > LoongArch: Added Loongson ASX vector directive compilation > framework. > LoongArch: Added Loongson ASX base instruction support. > LoongArch: Added Loongson ASX directive builtin function support. > > gcc/config.gcc | 2 +- > gcc/config/loongarch/constraints.md | 128 +- > .../loongarch/genopts/loongarch-strings | 4 + > gcc/config/loongarch/genopts/loongarch.opt.in | 16 +- > gcc/config/loongarch/lasx.md | 5147 ++++++++++++++++ > gcc/config/loongarch/lasxintrin.h | 5342 > +++++++++++++++++ > gcc/config/loongarch/loongarch-builtins.cc | 2686 ++++++++- > gcc/config/loongarch/loongarch-c.cc | 18 + > gcc/config/loongarch/loongarch-def.c | 6 + > gcc/config/loongarch/loongarch-def.h | 9 +- > gcc/config/loongarch/loongarch-driver.cc | 10 + > gcc/config/loongarch/loongarch-driver.h | 2 + > gcc/config/loongarch/loongarch-ftypes.def | 666 +- > gcc/config/loongarch/loongarch-modes.def | 39 + > gcc/config/loongarch/loongarch-opts.cc | 89 +- > gcc/config/loongarch/loongarch-opts.h | 3 + > gcc/config/loongarch/loongarch-protos.h | 35 + > gcc/config/loongarch/loongarch-str.h | 3 + > gcc/config/loongarch/loongarch.cc | 4615 +++++++++++++- > gcc/config/loongarch/loongarch.h | 117 +- > gcc/config/loongarch/loongarch.md | 56 +- > gcc/config/loongarch/loongarch.opt | 16 +- > gcc/config/loongarch/lsx.md | 4490 ++++++++++++++ > gcc/config/loongarch/lsxintrin.h | 5181 ++++++++++++++++ > gcc/config/loongarch/predicates.md | 333 +- > 25 files changed, 28723 insertions(+), 290 deletions(-) > create mode 100644 gcc/config/loongarch/lasx.md > create mode 100644 gcc/config/loongarch/lasxintrin.h > create mode 100644 gcc/config/loongarch/lsx.md > create mode 100644 gcc/config/loongarch/lsxintrin.h > -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University