https://github.com/tangaac updated https://github.com/llvm/llvm-project/pull/116762
>From eef0e50043c45ea6ca22af266bcc833ce9bbaf0d Mon Sep 17 00:00:00 2001 From: tangaac <tangya...@loongson.cn> Date: Fri, 1 Nov 2024 17:28:38 +0800 Subject: [PATCH] [LoongArch] Support feature ld-seq-sa that don't generate dbar 0x700. --- clang/include/clang/Driver/Options.td | 4 + clang/lib/Basic/Targets/LoongArch.cpp | 7 +- clang/lib/Basic/Targets/LoongArch.h | 2 + .../lib/Driver/ToolChains/Arch/LoongArch.cpp | 9 + clang/test/Driver/loongarch-march.c | 8 +- clang/test/Driver/loongarch-mld-seq-sa.c | 30 + clang/test/Preprocessor/init-loongarch.c | 25 +- .../TargetParser/LoongArchTargetParser.def | 3 +- .../llvm/TargetParser/LoongArchTargetParser.h | 4 + llvm/lib/Target/LoongArch/LoongArch.td | 5 + .../LoongArchExpandAtomicPseudoInsts.cpp | 4 +- .../TargetParser/LoongArchTargetParser.cpp | 1 + .../ir-instruction/atomic-cmpxchg.ll | 1145 +++++++++++++++++ 13 files changed, 1232 insertions(+), 15 deletions(-) create mode 100644 clang/test/Driver/loongarch-mld-seq-sa.c diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index d7230dd7272fd6..3ebb682397a0b6 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5416,6 +5416,10 @@ def mlam_bh : Flag<["-"], "mlam-bh">, Group<m_loongarch_Features_Group>, HelpText<"Enable amswap[_db].{b/h} and amadd[_db].{b/h}">; def mno_lam_bh : Flag<["-"], "mno-lam-bh">, Group<m_loongarch_Features_Group>, HelpText<"Disable amswap[_db].{b/h} and amadd[_db].{b/h}">; +def mld_seq_sa : Flag<["-"], "mld-seq-sa">, Group<m_loongarch_Features_Group>, + HelpText<"Do not generate load-load barrier instructions (dbar 0x700)">; +def mno_ld_seq_sa : Flag<["-"], "mno-ld-seq-sa">, Group<m_loongarch_Features_Group>, + HelpText<"Generate load-load barrier instructions (dbar 0x700)">; def mannotate_tablejump : Flag<["-"], "mannotate-tablejump">, Group<m_loongarch_Features_Group>, HelpText<"Enable annotate table jump instruction to correlate it with the jump table.">; def mno_annotate_tablejump : Flag<["-"], "mno-annotate-tablejump">, Group<m_loongarch_Features_Group>, diff --git a/clang/lib/Basic/Targets/LoongArch.cpp b/clang/lib/Basic/Targets/LoongArch.cpp index 07b22b35f603ce..3f2d7317532aaf 100644 --- a/clang/lib/Basic/Targets/LoongArch.cpp +++ b/clang/lib/Basic/Targets/LoongArch.cpp @@ -205,7 +205,7 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts, // TODO: As more features of the V1.1 ISA are supported, a unified "v1.1" // arch feature set will be used to include all sub-features belonging to // the V1.1 ISA version. - if (HasFeatureFrecipe && HasFeatureLAM_BH) + if (HasFeatureFrecipe && HasFeatureLAM_BH && HasFeatureLD_SEQ_SA) Builder.defineMacro("__loongarch_arch", Twine('"') + "la64v1.1" + Twine('"')); else @@ -239,6 +239,9 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts, if (HasFeatureLAM_BH) Builder.defineMacro("__loongarch_lam_bh", Twine(1)); + if (HasFeatureLD_SEQ_SA) + Builder.defineMacro("__loongarch_ld_seq_sa", Twine(1)); + StringRef ABI = getABI(); if (ABI == "lp64d" || ABI == "lp64f" || ABI == "lp64s") Builder.defineMacro("__loongarch_lp64"); @@ -317,6 +320,8 @@ bool LoongArchTargetInfo::handleTargetFeatures( HasFeatureFrecipe = true; else if (Feature == "+lam-bh") HasFeatureLAM_BH = true; + else if (Feature == "+ld-seq-sa") + HasFeatureLD_SEQ_SA = true; } return true; } diff --git a/clang/lib/Basic/Targets/LoongArch.h b/clang/lib/Basic/Targets/LoongArch.h index 3585e9f7968b4b..e5eae7a8fcf677 100644 --- a/clang/lib/Basic/Targets/LoongArch.h +++ b/clang/lib/Basic/Targets/LoongArch.h @@ -31,6 +31,7 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo { bool HasFeatureLASX; bool HasFeatureFrecipe; bool HasFeatureLAM_BH; + bool HasFeatureLD_SEQ_SA; public: LoongArchTargetInfo(const llvm::Triple &Triple, const TargetOptions &) @@ -41,6 +42,7 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo { HasFeatureLASX = false; HasFeatureFrecipe = false; HasFeatureLAM_BH = false; + HasFeatureLD_SEQ_SA = false; LongDoubleWidth = 128; LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); diff --git a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp index 987db4638fca88..67b71a3ec623e4 100644 --- a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp +++ b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp @@ -274,6 +274,15 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D, else Features.push_back("-lam-bh"); } + + // Select ld-seq-sa feature determined by -m[no-]ld-seq-sa. + if (const Arg *A = Args.getLastArg(options::OPT_mld_seq_sa, + options::OPT_mno_ld_seq_sa)) { + if (A->getOption().matches(options::OPT_mld_seq_sa)) + Features.push_back("+ld-seq-sa"); + else + Features.push_back("-ld-seq-sa"); + } } std::string loongarch::postProcessTargetCPUString(const std::string &CPU, diff --git a/clang/test/Driver/loongarch-march.c b/clang/test/Driver/loongarch-march.c index d4cd5b07ae905f..c7091336f3bc80 100644 --- a/clang/test/Driver/loongarch-march.c +++ b/clang/test/Driver/loongarch-march.c @@ -39,21 +39,21 @@ // CC1-LA64V1P1: "-target-cpu" "loongarch64" // CC1-LA64V1P1-NOT: "-target-feature" -// CC1-LA64V1P1: "-target-feature" "+64bit" "-target-feature" "+d" "-target-feature" "+lsx" "-target-feature" "+ual" "-target-feature" "+frecipe" "-target-feature" "+lam-bh" +// CC1-LA64V1P1: "-target-feature" "+64bit" "-target-feature" "+d" "-target-feature" "+lsx" "-target-feature" "+ual" "-target-feature" "+frecipe" "-target-feature" "+lam-bh" "-target-feature" "+ld-seq-sa" // CC1-LA64V1P1-NOT: "-target-feature" // CC1-LA64V1P1: "-target-abi" "lp64d" // CC1-LA664: "-target-cpu" "la664" // CC1-LA664-NOT: "-target-feature" -// CC1-LA664: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d" "-target-feature" "+lsx" "-target-feature" "+lasx" "-target-feature" "+ual" "-target-feature" "+frecipe" "-target-feature" "+lam-bh" +// CC1-LA664: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d" "-target-feature" "+lsx" "-target-feature" "+lasx" "-target-feature" "+ual" "-target-feature" "+frecipe" "-target-feature" "+lam-bh" "-target-feature" "+ld-seq-sa" // CC1-LA664-NOT: "-target-feature" // CC1-LA664: "-target-abi" "lp64d" // IR-LOONGARCH64: attributes #[[#]] ={{.*}}"target-cpu"="loongarch64" {{.*}}"target-features"="+64bit,+d,+f,+ual" // IR-LA464: attributes #[[#]] ={{.*}}"target-cpu"="la464" {{.*}}"target-features"="+64bit,+d,+f,+lasx,+lsx,+ual" // IR-LA64V1P0: attributes #[[#]] ={{.*}}"target-cpu"="loongarch64" {{.*}}"target-features"="+64bit,+d,+lsx,+ual" -// IR-LA64V1P1: attributes #[[#]] ={{.*}}"target-cpu"="loongarch64" {{.*}}"target-features"="+64bit,+d,+frecipe,+lam-bh,+lsx,+ual" -// IR-LA664: attributes #[[#]] ={{.*}}"target-cpu"="la664" {{.*}}"target-features"="+64bit,+d,+f,+frecipe,+lam-bh,+lasx,+lsx,+ual" +// IR-LA64V1P1: attributes #[[#]] ={{.*}}"target-cpu"="loongarch64" {{.*}}"target-features"="+64bit,+d,+frecipe,+lam-bh,+ld-seq-sa,+lsx,+ual" +// IR-LA664: attributes #[[#]] ={{.*}}"target-cpu"="la664" {{.*}}"target-features"="+64bit,+d,+f,+frecipe,+lam-bh,+lasx,+ld-seq-sa,+lsx,+ual" int foo(void) { return 3; diff --git a/clang/test/Driver/loongarch-mld-seq-sa.c b/clang/test/Driver/loongarch-mld-seq-sa.c new file mode 100644 index 00000000000000..3d1d90d3f9cf72 --- /dev/null +++ b/clang/test/Driver/loongarch-mld-seq-sa.c @@ -0,0 +1,30 @@ +/// Test -m[no]ld-seq-sa options. + +// RUN: %clang --target=loongarch64 -mld-seq-sa -fsyntax-only %s -### 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CC1-ld-seq-sa +// RUN: %clang --target=loongarch64 -mno-ld-seq-sa -fsyntax-only %s -### 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CC1-NO-ld-seq-sa +// RUN: %clang --target=loongarch64 -mno-ld-seq-sa -mld-seq-sa -fsyntax-only %s -### 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CC1-ld-seq-sa +// RUN: %clang --target=loongarch64 -mld-seq-sa -mno-ld-seq-sa -fsyntax-only %s -### 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CC1-NO-ld-seq-sa + +// RUN: %clang --target=loongarch64 -mld-seq-sa -S -emit-llvm %s -o - | \ +// RUN: FileCheck %s --check-prefix=IR-ld-seq-sa +// RUN: %clang --target=loongarch64 -mno-ld-seq-sa -S -emit-llvm %s -o - | \ +// RUN: FileCheck %s --check-prefix=IR-NO-ld-seq-sa +// RUN: %clang --target=loongarch64 -mno-ld-seq-sa -mld-seq-sa -S -emit-llvm %s -o - | \ +// RUN: FileCheck %s --check-prefix=IR-ld-seq-sa +// RUN: %clang --target=loongarch64 -mld-seq-sa -mno-ld-seq-sa -S -emit-llvm %s -o - | \ +// RUN: FileCheck %s --check-prefix=IR-NO-ld-seq-sa + + +// CC1-ld-seq-sa: "-target-feature" "+ld-seq-sa" +// CC1-NO-ld-seq-sa: "-target-feature" "-ld-seq-sa" + +// IR-ld-seq-sa: attributes #[[#]] ={{.*}}"target-features"="{{(.*,)?}}+ld-seq-sa{{(,.*)?}}" +// IR-NO-ld-seq-sa: attributes #[[#]] ={{.*}}"target-features"="{{(.*,)?}}-ld-seq-sa{{(,.*)?}}" + +int foo(void) { + return 42; +} diff --git a/clang/test/Preprocessor/init-loongarch.c b/clang/test/Preprocessor/init-loongarch.c index 8019292e0f10e0..0eb6977a2553c9 100644 --- a/clang/test/Preprocessor/init-loongarch.c +++ b/clang/test/Preprocessor/init-loongarch.c @@ -798,7 +798,7 @@ // LA64-FPU0-LP64S-NOT: #define __loongarch_single_float // LA64-FPU0-LP64S: #define __loongarch_soft_float 1 -/// Check __loongarch_arch{_tune/_frecipe/_lam_bh}. +/// Check __loongarch_arch{_tune/_frecipe/_lam_bh/_ld_seq_sa}. // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - | \ // RUN: FileCheck --match-full-lines --check-prefix=ARCH-TUNE -DARCH=la64v1.0 -DTUNE=loongarch64 %s @@ -823,11 +823,11 @@ // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -Xclang -target-feature -Xclang +lsx | \ // RUN: FileCheck --match-full-lines --check-prefix=ARCH-TUNE -DARCH=la64v1.0 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.1 | \ -// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH -DARCH=la64v1.1 -DTUNE=loongarch64 %s +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH,LD-SEQ-SA -DARCH=la64v1.1 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.1 -Xclang -target-feature -Xclang -frecipe | \ -// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LAM-BH -DARCH=la64v1.0 -DTUNE=loongarch64 %s +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LAM-BH,LD-SEQ-SA -DARCH=la64v1.0 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.1 -Xclang -target-feature -Xclang -lsx | \ -// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH -DARCH=loongarch64 -DTUNE=loongarch64 %s +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH,LD-SEQ-SA -DARCH=loongarch64 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -Xclang -target-feature -Xclang +frecipe | \ // RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE -DARCH=loongarch64 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -Xclang -target-feature -Xclang +lsx -Xclang -target-feature -Xclang +frecipe | \ @@ -835,25 +835,34 @@ // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.0 -Xclang -target-feature -Xclang +lam-bh | \ // RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LAM-BH -DARCH=la64v1.0 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.1 -Xclang -target-feature -Xclang -lam-bh | \ -// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE -DARCH=la64v1.0 -DTUNE=loongarch64 %s +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LD-SEQ-SA -DARCH=la64v1.0 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -Xclang -target-feature -Xclang +lam-bh | \ // RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LAM-BH -DARCH=loongarch64 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -Xclang -target-feature -Xclang +lsx -Xclang -target-feature -Xclang +lam-bh | \ // RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LAM-BH -DARCH=la64v1.0 -DTUNE=loongarch64 %s -// RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.0 -Xclang -target-feature -Xclang +frecipe -Xclang -target-feature -Xclang +lam-bh | \ +// RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.0 -Xclang -target-feature -Xclang +ld-seq-sa | \ +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LD-SEQ-SA -DARCH=la64v1.0 -DTUNE=loongarch64 %s +// RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.1 -Xclang -target-feature -Xclang -ld-seq-sa | \ +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH -DARCH=la64v1.0 -DTUNE=loongarch64 %s +// RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -Xclang -target-feature -Xclang +ld-seq-sa | \ +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LD-SEQ-SA -DARCH=loongarch64 -DTUNE=loongarch64 %s +// RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -Xclang -target-feature -Xclang +lsx -Xclang -target-feature -Xclang +ld-seq-sa | \ +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,LD-SEQ-SA -DARCH=la64v1.0 -DTUNE=loongarch64 %s +// RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la64v1.0 -Xclang -target-feature -Xclang +frecipe -Xclang -target-feature -Xclang +lam-bh -Xclang -target-feature -Xclang +ld-seq-sa | \ // RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE -DARCH=la64v1.1 -DTUNE=loongarch64 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la664 | \ -// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH -DARCH=la664 -DTUNE=la664 %s +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH,LD-SEQ-SA -DARCH=la664 -DTUNE=la664 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -mtune=la664 | \ // RUN: FileCheck --match-full-lines --check-prefix=ARCH-TUNE -DARCH=la64v1.0 -DTUNE=la664 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=loongarch64 -mtune=la664 | \ // RUN: FileCheck --match-full-lines --check-prefix=ARCH-TUNE -DARCH=loongarch64 -DTUNE=la664 %s // RUN: %clang --target=loongarch64 -x c -E -dM %s -o - -march=la664 -mtune=loongarch64 | \ -// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH -DARCH=la664 -DTUNE=loongarch64 %s +// RUN: FileCheck --match-full-lines --check-prefixes=ARCH-TUNE,FRECIPE,LAM-BH,LD-SEQ-SA -DARCH=la664 -DTUNE=loongarch64 %s // ARCH-TUNE: #define __loongarch_arch "[[ARCH]]" // FRECIPE: #define __loongarch_frecipe 1 // LAM-BH: #define __loongarch_lam_bh 1 +// LD-SEQ-SA: #define __loongarch_ld_seq_sa 1 // ARCH-TUNE: #define __loongarch_tune "[[TUNE]]" // RUN: %clang --target=loongarch64 -mlsx -x c -E -dM %s -o - \ diff --git a/llvm/include/llvm/TargetParser/LoongArchTargetParser.def b/llvm/include/llvm/TargetParser/LoongArchTargetParser.def index 6cd2018b7b59cb..324d5c18e6dea3 100644 --- a/llvm/include/llvm/TargetParser/LoongArchTargetParser.def +++ b/llvm/include/llvm/TargetParser/LoongArchTargetParser.def @@ -12,6 +12,7 @@ LOONGARCH_FEATURE("+lvz", FK_LVZ) LOONGARCH_FEATURE("+ual", FK_UAL) LOONGARCH_FEATURE("+frecipe", FK_FRECIPE) LOONGARCH_FEATURE("+lam-bh", FK_LAM_BH) +LOONGARCH_FEATURE("+ld-seq-sa", FK_LD_SEQ_SA) #undef LOONGARCH_FEATURE @@ -21,6 +22,6 @@ LOONGARCH_FEATURE("+lam-bh", FK_LAM_BH) LOONGARCH_ARCH("loongarch64", AK_LOONGARCH64, FK_64BIT | FK_FP32 | FK_FP64 | FK_UAL) LOONGARCH_ARCH("la464", AK_LA464, FK_64BIT | FK_FP32 | FK_FP64 | FK_LSX | FK_LASX | FK_UAL) -LOONGARCH_ARCH("la664", AK_LA664, FK_64BIT | FK_FP32 | FK_FP64 | FK_LSX | FK_LASX | FK_UAL | FK_FRECIPE | FK_LAM_BH) +LOONGARCH_ARCH("la664", AK_LA664, FK_64BIT | FK_FP32 | FK_FP64 | FK_LSX | FK_LASX | FK_UAL | FK_FRECIPE | FK_LAM_BH | FK_LD_SEQ_SA) #undef LOONGARCH_ARCH diff --git a/llvm/include/llvm/TargetParser/LoongArchTargetParser.h b/llvm/include/llvm/TargetParser/LoongArchTargetParser.h index b5be03b1b67fbb..00957b84ab576c 100644 --- a/llvm/include/llvm/TargetParser/LoongArchTargetParser.h +++ b/llvm/include/llvm/TargetParser/LoongArchTargetParser.h @@ -53,6 +53,10 @@ enum FeatureKind : uint32_t { // Atomic memory swap and add instructions for byte and half word are // available. FK_LAM_BH = 1 << 10, + + // Do not generate load-load barrier instructions (dbar 0x700). + FK_LD_SEQ_SA = 1 << 12, + }; struct FeatureInfo { diff --git a/llvm/lib/Target/LoongArch/LoongArch.td b/llvm/lib/Target/LoongArch/LoongArch.td index ecd00cd6d5d619..100bdba36c440c 100644 --- a/llvm/lib/Target/LoongArch/LoongArch.td +++ b/llvm/lib/Target/LoongArch/LoongArch.td @@ -118,6 +118,11 @@ def FeatureLAM_BH "Support amswap[_db].{b/h} and amadd[_db].{b/h} instructions.">; def HasLAM_BH : Predicate<"Subtarget->hasLAM_BH()">; +def FeatureLD_SEQ_SA + : SubtargetFeature<"ld-seq-sa", "HasLD_SEQ_SA", "true", + "Don't use load-load barrier (dbar 0x700).">; +def HasLD_SEQ_SA : Predicate<"Subtarget->hasLD_SEQ_SA()">; + def TunePreferWInst : SubtargetFeature<"prefer-w-inst", "PreferWInst", "true", "Prefer instructions with W suffix">; diff --git a/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp b/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp index 18a532b55ee5a9..35f84425cb0eba 100644 --- a/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp +++ b/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp @@ -588,7 +588,9 @@ bool LoongArchExpandAtomicPseudo::expandAtomicCmpXchg( // .tail: // dbar 0x700 | acquire - BuildMI(TailMBB, DL, TII->get(LoongArch::DBAR)).addImm(hint); + + if (!(hint == 0x700 && MF->getSubtarget<LoongArchSubtarget>().hasLD_SEQ_SA())) + BuildMI(TailMBB, DL, TII->get(LoongArch::DBAR)).addImm(hint); NextMBBI = MBB.end(); MI.eraseFromParent(); diff --git a/llvm/lib/TargetParser/LoongArchTargetParser.cpp b/llvm/lib/TargetParser/LoongArchTargetParser.cpp index 27e3b5683c5a6e..9b8407a73bea3f 100644 --- a/llvm/lib/TargetParser/LoongArchTargetParser.cpp +++ b/llvm/lib/TargetParser/LoongArchTargetParser.cpp @@ -53,6 +53,7 @@ bool LoongArch::getArchFeatures(StringRef Arch, if (Arch == "la64v1.1") { Features.push_back("+frecipe"); Features.push_back("+lam-bh"); + Features.push_back("+ld-seq-sa"); } return true; } diff --git a/llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll b/llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll index ad98397dfe8f02..b457beb47eab99 100644 --- a/llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll +++ b/llvm/test/CodeGen/LoongArch/ir-instruction/atomic-cmpxchg.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64 +; RUN: llc --mtriple=loongarch64 -mattr=+d,+ld-seq-sa < %s | FileCheck %s --check-prefix=LA64-LD-SEQ-SA define void @cmpxchg_i8_acquire_acquire(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; LA64-LABEL: cmpxchg_i8_acquire_acquire: @@ -26,6 +27,55 @@ define void @cmpxchg_i8_acquire_acquire(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; LA64-NEXT: dbar 20 ; LA64-NEXT: .LBB0_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i8_acquire_acquire: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB0_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB0_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB0_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB0_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB0_4 +; LA64-LD-SEQ-SA-NEXT: .LBB0_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB0_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i8_acquire_acquire: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB0_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB0_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB0_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB0_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB0_4 +; LA64-LD-SEQ_SA-NEXT: .LBB0_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB0_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val acquire acquire ret void } @@ -56,6 +106,57 @@ define void @cmpxchg_i16_acquire_acquire(ptr %ptr, i16 %cmp, i16 %val) nounwind ; LA64-NEXT: dbar 20 ; LA64-NEXT: .LBB1_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i16_acquire_acquire: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB1_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB1_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB1_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB1_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB1_4 +; LA64-LD-SEQ-SA-NEXT: .LBB1_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB1_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i16_acquire_acquire: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB1_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB1_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB1_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB1_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB1_4 +; LA64-LD-SEQ_SA-NEXT: .LBB1_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB1_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val acquire acquire ret void } @@ -76,6 +177,37 @@ define void @cmpxchg_i32_acquire_acquire(ptr %ptr, i32 %cmp, i32 %val) nounwind ; LA64-NEXT: dbar 20 ; LA64-NEXT: .LBB2_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i32_acquire_acquire: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ-SA-NEXT: .LBB2_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB2_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB2_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB2_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB2_4 +; LA64-LD-SEQ-SA-NEXT: .LBB2_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB2_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i32_acquire_acquire: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ_SA-NEXT: .LBB2_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB2_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB2_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB2_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB2_4 +; LA64-LD-SEQ_SA-NEXT: .LBB2_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB2_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val acquire acquire ret void } @@ -95,6 +227,35 @@ define void @cmpxchg_i64_acquire_acquire(ptr %ptr, i64 %cmp, i64 %val) nounwind ; LA64-NEXT: dbar 20 ; LA64-NEXT: .LBB3_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i64_acquire_acquire: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: .LBB3_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB3_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB3_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB3_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB3_4 +; LA64-LD-SEQ-SA-NEXT: .LBB3_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB3_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i64_acquire_acquire: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: .LBB3_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB3_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB3_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB3_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB3_4 +; LA64-LD-SEQ_SA-NEXT: .LBB3_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB3_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val acquire acquire ret void } @@ -124,6 +285,53 @@ define void @cmpxchg_i8_acquire_monotonic(ptr %ptr, i8 %cmp, i8 %val) nounwind { ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB4_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i8_acquire_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB4_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB4_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB4_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB4_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB4_4 +; LA64-LD-SEQ-SA-NEXT: .LBB4_3: +; LA64-LD-SEQ-SA-NEXT: .LBB4_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i8_acquire_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB4_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB4_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB4_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB4_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB4_4 +; LA64-LD-SEQ_SA-NEXT: .LBB4_3: +; LA64-LD-SEQ_SA-NEXT: .LBB4_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val acquire monotonic ret void } @@ -154,6 +362,55 @@ define void @cmpxchg_i16_acquire_monotonic(ptr %ptr, i16 %cmp, i16 %val) nounwin ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB5_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i16_acquire_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB5_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB5_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB5_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB5_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB5_4 +; LA64-LD-SEQ-SA-NEXT: .LBB5_3: +; LA64-LD-SEQ-SA-NEXT: .LBB5_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i16_acquire_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB5_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB5_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB5_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB5_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB5_4 +; LA64-LD-SEQ_SA-NEXT: .LBB5_3: +; LA64-LD-SEQ_SA-NEXT: .LBB5_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val acquire monotonic ret void } @@ -174,6 +431,35 @@ define void @cmpxchg_i32_acquire_monotonic(ptr %ptr, i32 %cmp, i32 %val) nounwin ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB6_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i32_acquire_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ-SA-NEXT: .LBB6_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB6_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB6_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB6_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB6_4 +; LA64-LD-SEQ-SA-NEXT: .LBB6_3: +; LA64-LD-SEQ-SA-NEXT: .LBB6_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i32_acquire_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ_SA-NEXT: .LBB6_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB6_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB6_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB6_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB6_4 +; LA64-LD-SEQ_SA-NEXT: .LBB6_3: +; LA64-LD-SEQ_SA-NEXT: .LBB6_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val acquire monotonic ret void } @@ -193,6 +479,33 @@ define void @cmpxchg_i64_acquire_monotonic(ptr %ptr, i64 %cmp, i64 %val) nounwin ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB7_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i64_acquire_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: .LBB7_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB7_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB7_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB7_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB7_4 +; LA64-LD-SEQ-SA-NEXT: .LBB7_3: +; LA64-LD-SEQ-SA-NEXT: .LBB7_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i64_acquire_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: .LBB7_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB7_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB7_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB7_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB7_4 +; LA64-LD-SEQ_SA-NEXT: .LBB7_3: +; LA64-LD-SEQ_SA-NEXT: .LBB7_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val acquire monotonic ret void } @@ -223,6 +536,57 @@ define i8 @cmpxchg_i8_acquire_acquire_reti8(ptr %ptr, i8 %cmp, i8 %val) nounwind ; LA64-NEXT: .LBB8_4: ; LA64-NEXT: srl.w $a0, $a5, $a3 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i8_acquire_acquire_reti8: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB8_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a6, $a1, .LBB8_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB8_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a6, .LBB8_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB8_4 +; LA64-LD-SEQ-SA-NEXT: .LBB8_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB8_4: +; LA64-LD-SEQ-SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i8_acquire_acquire_reti8: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB8_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a6, $a1, .LBB8_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB8_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a6, .LBB8_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB8_4 +; LA64-LD-SEQ_SA-NEXT: .LBB8_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB8_4: +; LA64-LD-SEQ_SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i8 %cmp, i8 %val acquire acquire %res = extractvalue { i8, i1 } %tmp, 0 ret i8 %res @@ -255,6 +619,59 @@ define i16 @cmpxchg_i16_acquire_acquire_reti16(ptr %ptr, i16 %cmp, i16 %val) nou ; LA64-NEXT: .LBB9_4: ; LA64-NEXT: srl.w $a0, $a5, $a3 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i16_acquire_acquire_reti16: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB9_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a6, $a1, .LBB9_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB9_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a6, .LBB9_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB9_4 +; LA64-LD-SEQ-SA-NEXT: .LBB9_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB9_4: +; LA64-LD-SEQ-SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i16_acquire_acquire_reti16: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB9_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a6, $a1, .LBB9_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB9_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a6, .LBB9_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB9_4 +; LA64-LD-SEQ_SA-NEXT: .LBB9_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB9_4: +; LA64-LD-SEQ_SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i16 %cmp, i16 %val acquire acquire %res = extractvalue { i16, i1 } %tmp, 0 ret i16 %res @@ -277,6 +694,39 @@ define i32 @cmpxchg_i32_acquire_acquire_reti32(ptr %ptr, i32 %cmp, i32 %val) nou ; LA64-NEXT: .LBB10_4: ; LA64-NEXT: move $a0, $a1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i32_acquire_acquire_reti32: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: addi.w $a3, $a1, 0 +; LA64-LD-SEQ-SA-NEXT: .LBB10_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a1, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a1, $a3, .LBB10_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB10_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB10_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB10_4 +; LA64-LD-SEQ-SA-NEXT: .LBB10_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB10_4: +; LA64-LD-SEQ-SA-NEXT: move $a0, $a1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i32_acquire_acquire_reti32: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: addi.w $a3, $a1, 0 +; LA64-LD-SEQ_SA-NEXT: .LBB10_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a1, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a1, $a3, .LBB10_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB10_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB10_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB10_4 +; LA64-LD-SEQ_SA-NEXT: .LBB10_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB10_4: +; LA64-LD-SEQ_SA-NEXT: move $a0, $a1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i32 %cmp, i32 %val acquire acquire %res = extractvalue { i32, i1 } %tmp, 0 ret i32 %res @@ -298,6 +748,37 @@ define i64 @cmpxchg_i64_acquire_acquire_reti64(ptr %ptr, i64 %cmp, i64 %val) nou ; LA64-NEXT: .LBB11_4: ; LA64-NEXT: move $a0, $a3 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i64_acquire_acquire_reti64: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: .LBB11_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB11_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB11_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB11_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB11_4 +; LA64-LD-SEQ-SA-NEXT: .LBB11_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB11_4: +; LA64-LD-SEQ-SA-NEXT: move $a0, $a3 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i64_acquire_acquire_reti64: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: .LBB11_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB11_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB11_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB11_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB11_4 +; LA64-LD-SEQ_SA-NEXT: .LBB11_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB11_4: +; LA64-LD-SEQ_SA-NEXT: move $a0, $a3 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i64 %cmp, i64 %val acquire acquire %res = extractvalue { i64, i1 } %tmp, 0 ret i64 %res @@ -331,6 +812,61 @@ define i1 @cmpxchg_i8_acquire_acquire_reti1(ptr %ptr, i8 %cmp, i8 %val) nounwind ; LA64-NEXT: xor $a0, $a1, $a0 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i8_acquire_acquire_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB12_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB12_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB12_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB12_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB12_4 +; LA64-LD-SEQ-SA-NEXT: .LBB12_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB12_4: +; LA64-LD-SEQ-SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i8_acquire_acquire_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB12_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB12_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB12_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB12_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB12_4 +; LA64-LD-SEQ_SA-NEXT: .LBB12_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB12_4: +; LA64-LD-SEQ_SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i8 %cmp, i8 %val acquire acquire %res = extractvalue { i8, i1 } %tmp, 1 ret i1 %res @@ -365,6 +901,63 @@ define i1 @cmpxchg_i16_acquire_acquire_reti1(ptr %ptr, i16 %cmp, i16 %val) nounw ; LA64-NEXT: xor $a0, $a1, $a0 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i16_acquire_acquire_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB13_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB13_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB13_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB13_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB13_4 +; LA64-LD-SEQ-SA-NEXT: .LBB13_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB13_4: +; LA64-LD-SEQ-SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i16_acquire_acquire_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB13_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB13_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB13_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB13_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB13_4 +; LA64-LD-SEQ_SA-NEXT: .LBB13_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB13_4: +; LA64-LD-SEQ_SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i16 %cmp, i16 %val acquire acquire %res = extractvalue { i16, i1 } %tmp, 1 ret i1 %res @@ -388,6 +981,41 @@ define i1 @cmpxchg_i32_acquire_acquire_reti1(ptr %ptr, i32 %cmp, i32 %val) nounw ; LA64-NEXT: xor $a0, $a3, $a1 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i32_acquire_acquire_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ-SA-NEXT: .LBB14_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB14_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB14_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB14_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB14_4 +; LA64-LD-SEQ-SA-NEXT: .LBB14_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB14_4: +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i32_acquire_acquire_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ_SA-NEXT: .LBB14_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB14_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB14_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB14_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB14_4 +; LA64-LD-SEQ_SA-NEXT: .LBB14_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB14_4: +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i32 %cmp, i32 %val acquire acquire %res = extractvalue { i32, i1 } %tmp, 1 ret i1 %res @@ -410,6 +1038,39 @@ define i1 @cmpxchg_i64_acquire_acquire_reti1(ptr %ptr, i64 %cmp, i64 %val) nounw ; LA64-NEXT: xor $a0, $a3, $a1 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i64_acquire_acquire_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: .LBB15_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB15_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB15_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB15_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB15_4 +; LA64-LD-SEQ-SA-NEXT: .LBB15_3: +; LA64-LD-SEQ-SA-NEXT: dbar 20 +; LA64-LD-SEQ-SA-NEXT: .LBB15_4: +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i64_acquire_acquire_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: .LBB15_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB15_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB15_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB15_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB15_4 +; LA64-LD-SEQ_SA-NEXT: .LBB15_3: +; LA64-LD-SEQ_SA-NEXT: dbar 20 +; LA64-LD-SEQ_SA-NEXT: .LBB15_4: +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i64 %cmp, i64 %val acquire acquire %res = extractvalue { i64, i1 } %tmp, 1 ret i1 %res @@ -440,6 +1101,53 @@ define void @cmpxchg_i8_monotonic_monotonic(ptr %ptr, i8 %cmp, i8 %val) nounwind ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB16_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i8_monotonic_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB16_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB16_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB16_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB16_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB16_4 +; LA64-LD-SEQ-SA-NEXT: .LBB16_3: +; LA64-LD-SEQ-SA-NEXT: .LBB16_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i8_monotonic_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB16_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB16_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB16_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB16_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB16_4 +; LA64-LD-SEQ_SA-NEXT: .LBB16_3: +; LA64-LD-SEQ_SA-NEXT: .LBB16_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i8 %cmp, i8 %val monotonic monotonic ret void } @@ -470,6 +1178,55 @@ define void @cmpxchg_i16_monotonic_monotonic(ptr %ptr, i16 %cmp, i16 %val) nounw ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB17_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i16_monotonic_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB17_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB17_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB17_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB17_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB17_4 +; LA64-LD-SEQ-SA-NEXT: .LBB17_3: +; LA64-LD-SEQ-SA-NEXT: .LBB17_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i16_monotonic_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB17_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB17_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB17_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB17_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB17_4 +; LA64-LD-SEQ_SA-NEXT: .LBB17_3: +; LA64-LD-SEQ_SA-NEXT: .LBB17_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i16 %cmp, i16 %val monotonic monotonic ret void } @@ -490,6 +1247,35 @@ define void @cmpxchg_i32_monotonic_monotonic(ptr %ptr, i32 %cmp, i32 %val) nounw ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB18_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i32_monotonic_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ-SA-NEXT: .LBB18_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB18_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB18_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB18_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB18_4 +; LA64-LD-SEQ-SA-NEXT: .LBB18_3: +; LA64-LD-SEQ-SA-NEXT: .LBB18_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i32_monotonic_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ_SA-NEXT: .LBB18_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB18_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB18_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB18_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB18_4 +; LA64-LD-SEQ_SA-NEXT: .LBB18_3: +; LA64-LD-SEQ_SA-NEXT: .LBB18_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i32 %cmp, i32 %val monotonic monotonic ret void } @@ -509,6 +1295,33 @@ define void @cmpxchg_i64_monotonic_monotonic(ptr %ptr, i64 %cmp, i64 %val) nounw ; LA64-NEXT: dbar 1792 ; LA64-NEXT: .LBB19_4: ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i64_monotonic_monotonic: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: .LBB19_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB19_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB19_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB19_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB19_4 +; LA64-LD-SEQ-SA-NEXT: .LBB19_3: +; LA64-LD-SEQ-SA-NEXT: .LBB19_4: +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i64_monotonic_monotonic: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: .LBB19_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB19_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB19_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB19_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB19_4 +; LA64-LD-SEQ_SA-NEXT: .LBB19_3: +; LA64-LD-SEQ_SA-NEXT: .LBB19_4: +; LA64-LD-SEQ_SA-NEXT: ret %res = cmpxchg ptr %ptr, i64 %cmp, i64 %val monotonic monotonic ret void } @@ -539,6 +1352,55 @@ define i8 @cmpxchg_i8_monotonic_monotonic_reti8(ptr %ptr, i8 %cmp, i8 %val) noun ; LA64-NEXT: .LBB20_4: ; LA64-NEXT: srl.w $a0, $a5, $a3 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i8_monotonic_monotonic_reti8: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB20_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a6, $a1, .LBB20_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB20_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a6, .LBB20_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB20_4 +; LA64-LD-SEQ-SA-NEXT: .LBB20_3: +; LA64-LD-SEQ-SA-NEXT: .LBB20_4: +; LA64-LD-SEQ-SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i8_monotonic_monotonic_reti8: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB20_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a6, $a1, .LBB20_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB20_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a6, .LBB20_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB20_4 +; LA64-LD-SEQ_SA-NEXT: .LBB20_3: +; LA64-LD-SEQ_SA-NEXT: .LBB20_4: +; LA64-LD-SEQ_SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i8 %cmp, i8 %val monotonic monotonic %res = extractvalue { i8, i1 } %tmp, 0 ret i8 %res @@ -571,6 +1433,57 @@ define i16 @cmpxchg_i16_monotonic_monotonic_reti16(ptr %ptr, i16 %cmp, i16 %val) ; LA64-NEXT: .LBB21_4: ; LA64-NEXT: srl.w $a0, $a5, $a3 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i16_monotonic_monotonic_reti16: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB21_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a6, $a1, .LBB21_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB21_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a6, .LBB21_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB21_4 +; LA64-LD-SEQ-SA-NEXT: .LBB21_3: +; LA64-LD-SEQ-SA-NEXT: .LBB21_4: +; LA64-LD-SEQ-SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i16_monotonic_monotonic_reti16: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB21_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a6, $a1, .LBB21_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB21_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a6, $a5, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a6, $a6, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a6, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a6, .LBB21_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB21_4 +; LA64-LD-SEQ_SA-NEXT: .LBB21_3: +; LA64-LD-SEQ_SA-NEXT: .LBB21_4: +; LA64-LD-SEQ_SA-NEXT: srl.w $a0, $a5, $a3 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i16 %cmp, i16 %val monotonic monotonic %res = extractvalue { i16, i1 } %tmp, 0 ret i16 %res @@ -593,6 +1506,37 @@ define i32 @cmpxchg_i32_monotonic_monotonic_reti32(ptr %ptr, i32 %cmp, i32 %val) ; LA64-NEXT: .LBB22_4: ; LA64-NEXT: move $a0, $a1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i32_monotonic_monotonic_reti32: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: addi.w $a3, $a1, 0 +; LA64-LD-SEQ-SA-NEXT: .LBB22_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a1, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a1, $a3, .LBB22_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB22_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB22_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB22_4 +; LA64-LD-SEQ-SA-NEXT: .LBB22_3: +; LA64-LD-SEQ-SA-NEXT: .LBB22_4: +; LA64-LD-SEQ-SA-NEXT: move $a0, $a1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i32_monotonic_monotonic_reti32: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: addi.w $a3, $a1, 0 +; LA64-LD-SEQ_SA-NEXT: .LBB22_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a1, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a1, $a3, .LBB22_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB22_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB22_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB22_4 +; LA64-LD-SEQ_SA-NEXT: .LBB22_3: +; LA64-LD-SEQ_SA-NEXT: .LBB22_4: +; LA64-LD-SEQ_SA-NEXT: move $a0, $a1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i32 %cmp, i32 %val monotonic monotonic %res = extractvalue { i32, i1 } %tmp, 0 ret i32 %res @@ -614,6 +1558,35 @@ define i64 @cmpxchg_i64_monotonic_monotonic_reti64(ptr %ptr, i64 %cmp, i64 %val) ; LA64-NEXT: .LBB23_4: ; LA64-NEXT: move $a0, $a3 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i64_monotonic_monotonic_reti64: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: .LBB23_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB23_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB23_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB23_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB23_4 +; LA64-LD-SEQ-SA-NEXT: .LBB23_3: +; LA64-LD-SEQ-SA-NEXT: .LBB23_4: +; LA64-LD-SEQ-SA-NEXT: move $a0, $a3 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i64_monotonic_monotonic_reti64: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: .LBB23_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB23_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB23_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB23_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB23_4 +; LA64-LD-SEQ_SA-NEXT: .LBB23_3: +; LA64-LD-SEQ_SA-NEXT: .LBB23_4: +; LA64-LD-SEQ_SA-NEXT: move $a0, $a3 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i64 %cmp, i64 %val monotonic monotonic %res = extractvalue { i64, i1 } %tmp, 0 ret i64 %res @@ -647,6 +1620,59 @@ define i1 @cmpxchg_i8_monotonic_monotonic_reti1(ptr %ptr, i8 %cmp, i8 %val) noun ; LA64-NEXT: xor $a0, $a1, $a0 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i8_monotonic_monotonic_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB24_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB24_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB24_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB24_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB24_4 +; LA64-LD-SEQ-SA-NEXT: .LBB24_3: +; LA64-LD-SEQ-SA-NEXT: .LBB24_4: +; LA64-LD-SEQ-SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i8_monotonic_monotonic_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $zero, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a1, $a1, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: andi $a2, $a2, 255 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB24_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB24_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB24_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB24_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB24_4 +; LA64-LD-SEQ_SA-NEXT: .LBB24_3: +; LA64-LD-SEQ_SA-NEXT: .LBB24_4: +; LA64-LD-SEQ_SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i8 %cmp, i8 %val monotonic monotonic %res = extractvalue { i8, i1 } %tmp, 1 ret i1 %res @@ -681,6 +1707,61 @@ define i1 @cmpxchg_i16_monotonic_monotonic_reti1(ptr %ptr, i16 %cmp, i16 %val) n ; LA64-NEXT: xor $a0, $a1, $a0 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i16_monotonic_monotonic_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ-SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ-SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ-SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ-SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ-SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ-SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ-SA-NEXT: .LBB25_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: bne $a5, $a1, .LBB25_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB25_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a5, .LBB25_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB25_4 +; LA64-LD-SEQ-SA-NEXT: .LBB25_3: +; LA64-LD-SEQ-SA-NEXT: .LBB25_4: +; LA64-LD-SEQ-SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i16_monotonic_monotonic_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: slli.d $a3, $a0, 3 +; LA64-LD-SEQ_SA-NEXT: bstrins.d $a0, $zero, 1, 0 +; LA64-LD-SEQ_SA-NEXT: lu12i.w $a4, 15 +; LA64-LD-SEQ_SA-NEXT: ori $a4, $a4, 4095 +; LA64-LD-SEQ_SA-NEXT: sll.w $a4, $a4, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a1, $a1, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a1, $a1, $a3 +; LA64-LD-SEQ_SA-NEXT: bstrpick.d $a2, $a2, 15, 0 +; LA64-LD-SEQ_SA-NEXT: sll.w $a2, $a2, $a3 +; LA64-LD-SEQ_SA-NEXT: .LBB25_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: and $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: bne $a5, $a1, .LBB25_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB25_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: andn $a5, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: or $a5, $a5, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a5, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a5, .LBB25_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB25_4 +; LA64-LD-SEQ_SA-NEXT: .LBB25_3: +; LA64-LD-SEQ_SA-NEXT: .LBB25_4: +; LA64-LD-SEQ_SA-NEXT: and $a0, $a3, $a4 +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a1, $a0 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i16 %cmp, i16 %val monotonic monotonic %res = extractvalue { i16, i1 } %tmp, 1 ret i1 %res @@ -704,6 +1785,39 @@ define i1 @cmpxchg_i32_monotonic_monotonic_reti1(ptr %ptr, i32 %cmp, i32 %val) n ; LA64-NEXT: xor $a0, $a3, $a1 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i32_monotonic_monotonic_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ-SA-NEXT: .LBB26_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB26_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB26_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB26_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB26_4 +; LA64-LD-SEQ-SA-NEXT: .LBB26_3: +; LA64-LD-SEQ-SA-NEXT: .LBB26_4: +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i32_monotonic_monotonic_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: addi.w $a1, $a1, 0 +; LA64-LD-SEQ_SA-NEXT: .LBB26_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.w $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB26_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB26_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.w $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB26_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB26_4 +; LA64-LD-SEQ_SA-NEXT: .LBB26_3: +; LA64-LD-SEQ_SA-NEXT: .LBB26_4: +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i32 %cmp, i32 %val monotonic monotonic %res = extractvalue { i32, i1 } %tmp, 1 ret i1 %res @@ -726,6 +1840,37 @@ define i1 @cmpxchg_i64_monotonic_monotonic_reti1(ptr %ptr, i64 %cmp, i64 %val) n ; LA64-NEXT: xor $a0, $a3, $a1 ; LA64-NEXT: sltui $a0, $a0, 1 ; LA64-NEXT: ret +; +; LA64-LD-SEQ-SA-LABEL: cmpxchg_i64_monotonic_monotonic_reti1: +; LA64-LD-SEQ-SA: # %bb.0: +; LA64-LD-SEQ-SA-NEXT: .LBB27_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ-SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: bne $a3, $a1, .LBB27_3 +; LA64-LD-SEQ-SA-NEXT: # %bb.2: # in Loop: Header=BB27_1 Depth=1 +; LA64-LD-SEQ-SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ-SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ-SA-NEXT: beqz $a4, .LBB27_1 +; LA64-LD-SEQ-SA-NEXT: b .LBB27_4 +; LA64-LD-SEQ-SA-NEXT: .LBB27_3: +; LA64-LD-SEQ-SA-NEXT: .LBB27_4: +; LA64-LD-SEQ-SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ-SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ-SA-NEXT: ret +; LA64-LD-SEQ_SA-LABEL: cmpxchg_i64_monotonic_monotonic_reti1: +; LA64-LD-SEQ_SA: # %bb.0: +; LA64-LD-SEQ_SA-NEXT: .LBB27_1: # =>This Inner Loop Header: Depth=1 +; LA64-LD-SEQ_SA-NEXT: ll.d $a3, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: bne $a3, $a1, .LBB27_3 +; LA64-LD-SEQ_SA-NEXT: # %bb.2: # in Loop: Header=BB27_1 Depth=1 +; LA64-LD-SEQ_SA-NEXT: move $a4, $a2 +; LA64-LD-SEQ_SA-NEXT: sc.d $a4, $a0, 0 +; LA64-LD-SEQ_SA-NEXT: beqz $a4, .LBB27_1 +; LA64-LD-SEQ_SA-NEXT: b .LBB27_4 +; LA64-LD-SEQ_SA-NEXT: .LBB27_3: +; LA64-LD-SEQ_SA-NEXT: .LBB27_4: +; LA64-LD-SEQ_SA-NEXT: xor $a0, $a3, $a1 +; LA64-LD-SEQ_SA-NEXT: sltui $a0, $a0, 1 +; LA64-LD-SEQ_SA-NEXT: ret %tmp = cmpxchg ptr %ptr, i64 %cmp, i64 %val monotonic monotonic %res = extractvalue { i64, i1 } %tmp, 1 ret i1 %res _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits