================
@@ -1319,7 +1351,21 @@ emitNeonCallToOp(CIRGenModule &cgm, CIRGenBuilderTy
&builder,
assert(!cir::MissingFeatures::emitConstrainedFPCall());
}
if (shift > 0 && shift == j) {
- cgm.errorNYI(loc, std::string("intrinsic requiring a shift Op"));
+ int sv = cast<cir::IntAttr>(
+ cast<cir::ConstantOp>(args[j].getDefiningOp()).getValue())
+ .getSInt();
+ // Create a scalar constant of the element type (with matching bitwidth).
+ // Then splat to a vector if needed.
+ auto vecTy = mlir::dyn_cast<cir::VectorType>(argTypes[j]);
+ mlir::Type eltTy = vecTy ? vecTy.getElementType() : argTypes[j];
+ unsigned width = mlir::cast<cir::IntType>(eltTy).getWidth();
+ llvm::APSInt shiftVal(width, /*isUnsigned=*/false);
+ shiftVal = rightshift ? -sv : sv;
+ mlir::Value scalarConst = cir::ConstantOp::create(
+ builder, loc, eltTy, cir::IntAttr::get(eltTy, shiftVal));
+ args[j] = vecTy
+ ? cir::VecSplatOp::create(builder, loc, vecTy, scalarConst)
+ : scalarConst;
----------------
ArfiH wrote:
Thank you for the continued feedback. I have now added `getIntValueFromConstOp`
and `emitNeonShiftVector` (copied from the incubator) to the upstream file, and
replaced the custom shift block in `emitNeonCallToOp` with a call to
`emitNeonShiftVector`. The implementation now matches the incubator.
https://github.com/llvm/llvm-project/pull/185992
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits