Skip to content
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

Add various integer ops #362

Merged
merged 4 commits into from
Sep 10, 2023
Merged

Add various integer ops #362

merged 4 commits into from
Sep 10, 2023

Conversation

calebzulawski
Copy link
Member

@calebzulawski calebzulawski commented Jul 30, 2023

Pending rust-lang/rust#114266 and an i16xN::trailing_zeros bug that I hope is fixed by LLVM 15 17

Good to go.

@workingjubilee
Copy link
Member

LLVM 15 is already our minimum.

@calebzulawski
Copy link
Member Author

Whoops, I meant 17

@workingjubilee
Copy link
Member

can you describe the bug?

@calebzulawski
Copy link
Member Author

calebzulawski commented Jul 30, 2023

I haven't looked at the codegen yet, but it reports that 4905 has 3 trailing zeros

---- i16::trailing_zeros::lanes_1 stdout ----
thread 'i16::trailing_zeros::lanes_1' panicked at 'called `Result::unwrap()` on an `Err` value: Fail(Reason("assertion failed: `(left == right)` \n  left: `[3 (3)]`,\n right: `[0 (0)]` at crates/test_helpers/src/lib.rs:175"), [4905])', /Users/caleb/repos/portable-simd/crates/test_helpers/src/lib.rs:117:43

---- i16::trailing_zeros::lanes_2 stdout ----
thread 'i16::trailing_zeros::lanes_2' panicked at 'called `Result::unwrap()` on an `Err` value: Fail(Reason("assertion failed: `(left == right)` \n  left: `[3 (3), 16 (10)]`,\n right: `[0 (0), 16 (10)]` at crates/test_helpers/src/lib.rs:175"), [4905, 0])', /Users/caleb/repos/portable-simd/crates/test_helpers/src/lib.rs:117:43

@calebzulawski
Copy link
Member Author

calebzulawski commented Jul 30, 2023

Aha, actually it's a bug in my test (I compare against leading_zeros). I'm disturbed that it only failed for i16, which led me to believe it couldn't be my test...

@sammysheep
Copy link
Contributor

Why is it called swap_bytes and not rev_bytes or some such thing? Say for u32 elements, is it swapping the high and low 16 bits, or are you reversing the byte order over all 4 bytes?

Sorry if this was stated elsewhere.

@calebzulawski
Copy link
Member Author

That is the name used by scalars for the same operation: https://doc.rust-lang.org/std/primitive.i32.html#method.swap_bytes

@calebzulawski calebzulawski marked this pull request as ready for review August 1, 2023 12:01
@calebzulawski calebzulawski merged commit 22f50df into master Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants