-
Notifications
You must be signed in to change notification settings - Fork 0
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
Should simd_mask support shift operators #78
Comments
I'm not 100% what that means. There are a by lane operations and there is what we call Which one is it? |
There's a clear answer: T x;
auto y = (x == 0) << 1; The type of friend constexpr simd_type
operator<<(simd_mask, int); This is also consistent with the other operator overloads in No objection from my side. I'd be interested in seeing a use case, though. :-) |
The only reason it works for bool is because of an implicit conversion. I think that in general implicit conversions for simd is an awful idea. But here - is there a mask implicit conversion to int? |
See Section 4.8 of P1928R3. This was subsequently implemented in P1928R4. |
? If implicit conversions from bool to int are to stay, I don't mind this. I didn't know about bool shift. |
Sorry, that was bad of me. I mean the second. What you call slide_left, or like https://en.cppreference.com/w/cpp/algorithm/shift.
|
O_o. That is a very useful operation but honestly I'd expect it to be called the same way as it would for simd.
Also - compile time shift only I'd say, otherwise even on avx2 this sucks. |
@danieltowner Why isn't |
It probably could be acceptable, it's just not as obvious perhaps, especially for someone coming from a target with bit masks. At the moment the code generated doesn't do very well either, but I guess the compiler could be taught to do better. The best code is generated by The best code is generated by assuming that https://isocpp.org/files/papers/P2876R0.html#compact_ctor is available ( If we had named functions, then |
A customer has requested that simd_mask should be shiftable, both in binary and compound assignment forms. Any objection to adding those?
The text was updated successfully, but these errors were encountered: