Make u64::midpoint auto-vectorize - #162568
programmerjake wants to merge 2 commits into
Conversation
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? libs |
|
I looked at other targets than x86_64 and they all seems to generate the same assembly for the scalar one, which is surprising (in a good way) since when I added those midpoint operations going through |
|
Should we check whether it's still beneficial to go through wider types on other unsigned(?) integers (e.g., i8/i16/i32)? The actual diff here is: -((self as u128 + rhs as u128) / 2) as u64
+((self ^ rhs) >> 1) + (self & rhs)It'd be useful to add documentation on @rustbot author |
As reported on Zulip, change
u64::midpointso it doesn't useu128internally so it auto-vectorizes. I also added a codegen test.I did not use a LLM to make this.