================
@@ -5278,6 +5278,46 @@ 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);
+ Value *StoreAddr = EmitScalarExpr(Arg0);
+ Value *StoreValue = EmitScalarExpr(E->getArg(1));
+ Value *Order = EmitScalarExpr(E->getArg(2));
+ Value *Policy = EmitScalarExpr(E->getArg(3));
+
+ auto *OrderC = dyn_cast<llvm::ConstantInt>(Order);
+ auto *PolicyC = dyn_cast<llvm::ConstantInt>(Policy);
+
+ assert(OrderC && PolicyC &&
+ "order/policy must be constant for __arm_atomic_store_with_stshh");
+
+ // Validate ordering argument; bail out if invalid
+ switch (OrderC->getZExtValue()) {
+ case 0: // __ATOMIC_RELAXED
+ case 3: // __ATOMIC_RELEASE
+ case 5: // __ATOMIC_SEQ_CST
+ break;
+ default:
+ llvm_unreachable(
+ "unexpected memory order for __arm_atomic_store_with_stshh");
+ }
+
+ llvm::Value *OrderArg =
+ llvm::ConstantInt::get(Int32Ty, OrderC->getZExtValue());
+ llvm::Value *PolicyArg =
+ llvm::ConstantInt::get(Int32Ty, PolicyC->getZExtValue());
----------------
jthackray wrote:
Thanks, hadn't spotted it would take in both forms. Fixed.
https://github.com/llvm/llvm-project/pull/181386
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits