[clang] [llvm] [AArch64] Implement the atomic store with hint intrinsic (PR #198316)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 05:23:55 PDT 2026


================
@@ -322,6 +323,94 @@ bool SemaARM::BuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
   return false;
 }
 
+bool SemaARM::BuiltinARMAtomicStoreHintCall(unsigned BuiltinID,
+                                            CallExpr *TheCall) {
+  if (SemaRef.checkArgCount(TheCall, 4))
+    return true;
+
+  // Arg 0 should be the pointer type. The pointee type must be a
+  // scalar integral or floating-point type of 8, 16, 32 or 64 bits.
+  ASTContext &Context = getASTContext();
+  auto PtrArgRes =
+      SemaRef.DefaultFunctionArrayLvalueConversion(TheCall->getArg(0));
+  if (PtrArgRes.isInvalid())
+    return true;
+  auto *PtrArg = PtrArgRes.get();
+  auto *PtrTy = PtrArg->getType()->getAs<PointerType>();
+  if (!PtrTy)
+    return Diag(TheCall->getBeginLoc(),
+                diag::err_atomic_hint_builtin_must_be_pointer)
+           << PtrArg->getType() << 0 << PtrArg->getSourceRange();
+  QualType PtrQT = PtrTy->getPointeeType();
+
+  if (!PtrQT->isIntegralType(getASTContext()) && !PtrQT->isFloatingType() &&
----------------
Lukacma wrote:

This current check makes the intrinsic not work with enum type unlike the [generic builtin ](https://godbolt.org/z/Ea3j68qx6) . I think that's okay, and consistent with ACLE spec, but wanted to highlight it in case other people have different opinion.

https://github.com/llvm/llvm-project/pull/198316


More information about the cfe-commits mailing list