mbutrovich commented on code in PR #12058:
URL: https://github.com/apache/arrow-rs/pull/12058#discussion_r4588942444
##########
arrow-arith/src/numeric.rs:
##########
@@ -327,6 +328,205 @@ macro_rules! try_op_ref {
}};
}
+/// Wrapping `+`, `-` and `*` that also report whether they overflowed, written
+/// so that LLVM vectorizes a loop over them.
+///
+/// The signed `overflowing_add` and `overflowing_sub` lower to
+/// `llvm.sadd.with.overflow` and `llvm.ssub.with.overflow`, which LLVM doesn't
+/// vectorize, so the signed impls test the sign bits instead.
+trait OverflowingOp: Sized {
+ /// Whether the checked kernels use the one-pass path for this type. When
+ /// it's false, [`overflowing_op`] returns `None` without doing any work.
+ const ONE_PASS: bool = true;
Review Comment:
> Could we drop the const and the early return until a type needs to opt out?
#12062 sets it to `false` for
[`i256`](https://github.com/apache/arrow-rs/blob/6e3c210e3ea3eac6e3eb0367a92ed0129ab8df2a/arrow-arith/src/numeric.rs#L556-L558).
The two PRs carry the same copy of these helpers, as you asked in
https://github.com/apache/arrow-rs/pull/12062#discussion_r4566189781, so
whichever merges first, the other rebases onto an identical copy. I'd rather
keep them identical than make one PR depend on the other.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]