[clang] [llvm] [AArch64][clang][llvm] Add ACLE `stshh` atomic store builtin (PR #181386)

Kerry McLaughlin via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 18 09:04:55 PST 2026


================
@@ -5290,6 +5290,56 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
     return Builder.CreateCall(F, Args);
   }
 
+  if (BuiltinID == clang::AArch64::BI__builtin_arm_atomic_store_with_stshh) {
+    const Expr *Arg0 = E->getArg(0);
+    const Expr *Arg1 = E->getArg(1);
+    const Expr *Arg2 = E->getArg(2);
+    const Expr *Arg3 = E->getArg(3);
+
+    Value *StoreAddr = EmitScalarExpr(Arg0);
+    Value *StoreValue = EmitScalarExpr(Arg1);
+
+    llvm::APSInt OrderVal = Arg2->EvaluateKnownConstInt(getContext());
+    llvm::APSInt RetentionPolicy = Arg3->EvaluateKnownConstInt(getContext());
----------------
kmclaughlin-arm wrote:

I don't think `Arg2` or `Arg3` are used elsewhere, could they be removed and this changed to:

```suggestion
    llvm::APSInt OrderVal = E->getArg(2)->EvaluateKnownConstInt(getContext());
    llvm::APSInt RetentionPolicy = E->getArg(3)->EvaluateKnownConstInt(getContext());
```

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


More information about the cfe-commits mailing list