[clang] [z/OS][Clang] Add compare and swap builtin functions (PR #202362)

Sean Perry via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 10:55:34 PDT 2026


================
@@ -68,11 +117,25 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
     Function *F = CGM.getIntrinsic(Intrinsic::s390_ntstg);
     return Builder.CreateCall(F, {Data, Address});
   }
+  case SystemZ::BI__cs: {
+    return EmitAtomicCmpXchgForZOSIntrin(*this, E, Int32Ty, false);
+  }
+  case SystemZ::BI__cs1: {
+    return EmitAtomicCmpXchgForZOSIntrin(*this, E, Int32Ty, true);
+  }
+  case SystemZ::BI__csg:
+  case SystemZ::BI__cds1: {
+    return EmitAtomicCmpXchgForZOSIntrin(*this, E, Int64Ty, true);
+  }
+  case SystemZ::BI__cdsg: {
+    llvm::Type *Int128Ty = llvm::IntegerType::get(getLLVMContext(), 128);
+    return EmitAtomicCmpXchgForZOSIntrin(*this, E, Int128Ty, true);
+  }
 
-  // Vector builtins.  Note that most vector builtins are mapped automatically
-  // to target-specific LLVM intrinsics.  The ones handled specially here can
-  // be represented via standard LLVM IR, which is preferable to enable common
-  // LLVM optimizations.
+    // Vector builtins.  Note that most vector builtins are mapped automatically
----------------
perry-ca wrote:

It's a nit but to keep history clean, can you undo this formatting change.

I see similar indentation changes in the enum definition.  Did clang-format reformat those because of the changes you had in the enum?

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


More information about the cfe-commits mailing list