[clang] [llvm] Add support for flag output operand "=@cc" for SystemZ. (PR #125970)

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 10 12:38:54 PST 2025


================
@@ -2563,9 +2563,15 @@ EmitAsmStores(CodeGenFunction &CGF, const AsmStmt &S,
     if ((i < ResultRegIsFlagReg.size()) && ResultRegIsFlagReg[i]) {
       // Target must guarantee the Value `Tmp` here is lowered to a boolean
       // value.
-      llvm::Constant *Two = llvm::ConstantInt::get(Tmp->getType(), 2);
+      unsigned CCUpperBound = 2;
+      if (CGF.getTarget().getTriple().getArch() == llvm::Triple::systemz) {
----------------
anoopkg6 wrote:

Removing llvm.assume intrinsic will cause performance hit. With CC range known, intrinsic guides optimizer to generate more optimized code. Verified it for SystemZ.

ResultRegIsFlagReg[i] will be true only if AsmStmt S has its  ith  OutputConstraint starts with "{@cc".

I have tried to abstract out Triple check. It adds to one virtual function call though. Any suggestions for abstracting it in a cleaner way? 

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


More information about the cfe-commits mailing list