================
@@ -18521,7 +18522,25 @@ AArch64TargetLowering::getTargetMMOFlags(const 
Instruction &I) const {
   if (Subtarget->getProcFamily() == AArch64Subtarget::Falkor &&
       I.hasMetadata(FALKOR_STRIDED_ACCESS_MD))
     return MOStridedAccess;
-  return MachineMemOperand::MONone;
+
+  auto Flags = MachineMemOperand::MONone;
+  const MDNode *AtomicStHint = I.getMetadata(AARCH64_ATOMIC_STORE_HINT_MD);
+  if (AtomicStHint) {
+    unsigned HintVal =
+        cast<ConstantInt>(
+            cast<ConstantAsMetadata>(AtomicStHint->getOperand(0))->getValue())
+            ->getZExtValue();
+    AArch64AtomicStoreHint Hint = getAtomicStoreHintFromMD(HintVal);
+    assert(Hint != AArch64AtomicStoreHint::HINT_NONE &&
+           "Unrecognised atomic hint value requested.");
----------------
kmclaughlin-arm wrote:

Unfortunately I can't just use `HintVal` here, because the immediate values 
from the metadata don't exactly match the values represented in 
`AArch64AtomicStoreHint`.

i.e. the docs specify that the hint values allowed are 0 (`HINT_STSHH_KEEP`) 
and 1 (`HINT_STSHH_STRM`). However, the value of `AArch64AtomicStoreHint` 
represented by 0 is `HINT_NONE`, meaning that neither `MOAtomicHintBit0` or 
`MOAtomicHintBit1` were set. I can try to change the LLVM intrinsic to use 
different immediate values to the builtin, but I'm not sure that makes sense.

https://github.com/llvm/llvm-project/pull/198316
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to