-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
pulley: Implement iadd_pairwise #9912
Conversation
1b1431d
to
6fe66a9
Compare
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "cranelift", "pulley"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
pulley/src/interp.rs
Outdated
let [h, t]: [_; 2] = pair.try_into().unwrap(); | ||
h.wrapping_add(t) | ||
}) | ||
.collect::<Vec<_>>() |
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.
For these instructions we'll definitely want to avoid an intermediate allocation of a Vec
. It might be reasonable to just use manual indices here and/or "macro expanding" some code. I don't think the standard library helpers for all this are necessarily the best way to go.
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 only have limited numbers of items to operate, maybe we can just write them out like:
fn vaddpairwisei16x8_s(&mut self, operands: BinaryOperands<VReg>) -> ControlFlow<Done> {
let a = self.state[operands.src1].get_i16x8();
let b = self.state[operands.src2].get_i16x8();
let mut result = [0i16; 8];
// Process first 4 elements from a
result[0] = a[0].wrapping_add(a[1]);
result[1] = a[2].wrapping_add(a[3]);
result[2] = a[4].wrapping_add(a[5]);
result[3] = a[6].wrapping_add(a[7]);
// Process first 4 elements from b
result[4] = b[0].wrapping_add(b[1]);
result[5] = b[2].wrapping_add(b[3]);
result[6] = b[4].wrapping_add(b[5]);
result[7] = b[6].wrapping_add(b[7]);
self.state[operands.dst].set_i16x8(result);
ControlFlow::Continue(())
}
This also has a compiler to perform better analysis, I suppose.
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.
Guess I need a mind shift for this :)
Co-authored-by: Xuanwo <[email protected]>
part of #9783