-
Notifications
You must be signed in to change notification settings - Fork 162
[CIR][CIRGen][Builtin][Neon] Lower neon_vqadds_s32 #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Looks like we have LLVM intrinsics for saturating instructions, have you considered changing binop to add a unitattr for saturation? Does the lowering for LLVM saturating intrinsics lead to the same neon instructions? |
I thought about it, wasn't sure if we're willing to saturation unitattr to BinOp as some kinds (like logical ones) wouldn't care about it. |
Actually, thanks for the point. Surprisingly, LLVM saturating intrinsics does not lead to the neon instruction. It generates more cubersome instruction sequences. |
After talking to @bcardosolopes, implement this with CIR AddOp with |
// TODO: Ideally, we should only need to check cir::IntType here. | ||
return mlir::isa<cir::IntType>(type) | ||
? mlir::cast<cir::IntType>(type).isUnsigned() | ||
: mlir::cast<mlir::IntegerType>(type).isUnsigned(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can actually check for unsigned for mlir::IntegerType too, so perhaps it will be fine to just rely on adaptor type if we need to.
This can't be simply implemented by our CIR Add via LLVM::AddOp, as i[t's saturated add.](https://godbolt.org/z/MxqGrj6fP)
This can't be simply implemented by our CIR Add via LLVM::AddOp, as it's saturated add.