[clang] [clang-tools-extra] [llvm] [X86] Use plain load/store instead of cmpxchg16b for atomics with AVX (PR #74275)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 12:21:07 PST 2023
================
@@ -31259,14 +31274,23 @@ static SDValue LowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG,
if (!IsSeqCst && IsTypeLegal)
return Op;
- if (VT == MVT::i64 && !IsTypeLegal) {
+ if (!IsTypeLegal && !Subtarget.useSoftFloat() &&
+ !DAG.getMachineFunction().getFunction().hasFnAttribute(
+ Attribute::NoImplicitFloat)) {
+ SDValue Chain;
+ // For illegal i128 atomic_store, when AVX is enabled, we can simply emit a
+ // vector store.
+ if (VT == MVT::i128) {
+ if (Subtarget.is64Bit() && Subtarget.hasAVX()) {
+ SDValue VecVal = DAG.getBitcast(MVT::v2i64, Node->getVal());
+ Chain = DAG.getStore(Node->getChain(), dl, VecVal, Node->getBasePtr(),
+ Node->getMemOperand());
+ }
+ }
+
// For illegal i64 atomic_stores, we can try to use MOVQ or MOVLPS if SSE
// is enabled.
- bool NoImplicitFloatOps =
- DAG.getMachineFunction().getFunction().hasFnAttribute(
- Attribute::NoImplicitFloat);
- if (!Subtarget.useSoftFloat() && !NoImplicitFloatOps) {
- SDValue Chain;
+ if (VT == MVT::i64) {
if (Subtarget.hasSSE1()) {
----------------
preames wrote:
Same here.
https://github.com/llvm/llvm-project/pull/74275
More information about the llvm-commits
mailing list