================
@@ -126,6 +126,81 @@ bool CIRGenFunction::getAArch64SVEProcessedOperands(
   return true;
 }
 
+// Reinterpret the input predicate so that it can be used to correctly isolate
+// the elements of the specified datatype.
+mlir::Value CIRGenFunction::emitSVEpredicateCast(mlir::Value *pred,
+                                                 unsigned minNumElts,
+                                                 mlir::Location loc) {
+
+  // TODO: Handle "aarch64.svcount" once we get round to supporting SME.
+
+  auto retTy = cir::VectorType::get(builder.getUIntNTy(1), minNumElts,
+                                    /*is_scalable=*/true);
+  if (pred->getType() == retTy)
+    return *pred;
+
+  unsigned intID;
+  mlir::Type intrinsicTy;
+  switch (minNumElts) {
+  default:
+    llvm_unreachable("unsupported element count!");
+  case 1:
+  case 2:
+  case 4:
+  case 8:
+    intID = Intrinsic::aarch64_sve_convert_from_svbool;
+    intrinsicTy = retTy;
+    break;
+  case 16:
+    intID = Intrinsic::aarch64_sve_convert_to_svbool;
+    intrinsicTy = pred->getType();
+    break;
+  }
+
+  std::string llvmIntrName(Intrinsic::getBaseName(intID));
+  llvmIntrName.erase(0, /*std::strlen(".llvm")=*/5);
----------------
banach-space wrote:

Great pointers, thanks!  

I've kept the original name, `llvmIntrName`, as a mildly more self-documenting 
option (and a personal preference). I hope that that's OK.

https://github.com/llvm/llvm-project/pull/175976
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to