[PATCH] D129838: [LoongArch] Optimize the atomic store with amswap_db.[w/d]

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 00:50:27 PDT 2022


SixWeining added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:1742-1748
+    unsigned Size = 0;
+    if (isa<StoreInst>(I))
+      Size = I->getOperand(0)->getType()->getIntegerBitWidth();
+    // On LA64, atomic store operations with IntegerBitWidth of 32 and 64 do not
+    // require fences beacuse we can use amswap_db.[w/d].
+    return isa<LoadInst>(I) || (isa<StoreInst>(I) && (Size == 8 || Size == 16));
+  }
----------------
SixWeining wrote:
> Size = isa<StoreInst>(I) ? I->getOperand(0)->getType()->getIntegerBitWidth() : 0;
How about:
```
  if (isa<LoadInst>(I))
    return true;

  // On LA64, atomic store operations with IntegerBitWidth of 32 and 64 do not
  // require fences beacuse we can use amswap_db.[w/d].
  if (isa<StoreInst>(I)) {
    unsigned Size = I->getOperand(0)->getType()->getIntegerBitWidth();
    return (Size == 8 || Size == 16);
  }

  return false;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129838/new/

https://reviews.llvm.org/D129838



More information about the llvm-commits mailing list