-
Notifications
You must be signed in to change notification settings - Fork 289
x86 __m128, __m256, __m512 rename / retype ? #214
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
Comments
IIRC, the motivation for defining these types was mostly as a way to express the vector type for intrinsics that don't really operate using any notion of lane width, and instead treat the vector as just a bunch of bits. I don't really know what the right choice is. I suppose a special
To a first approximation, any intrinsic ending in |
It occurs to me that a problem with the type alias approach is that they get the operators from the alias, but the Not using a type alias (independently of whether we just pick a concrete type, or create or own) would fix that. I thought a couple of times about just using Rust's That won't work for 256bit and 512bit though, and it will be another thing that those core users that don't have 128-bit support yet will need to work around. |
FWIW using |
Note the |
@alexcrichton do you know if one can use |
Nah it is not usable but rustc also won't generate it on arm |
@BurntSushi I've defined the new types in #232 and updated the tests to use them, but I haven't renamed them to |
Currently the
_m128i
and_m256i
are just type aliases fori8x16
andi8x32
:These are the places that are currently using them (unless my grep-fu failed, please correct me if I am missing some):
Comparing strings where the input is reinterpreted as 1byte.8bytes, ... depending on a flag:
_mm_cmpistrm
: Compare packed strings_mm_cmpestri
: Compare packed stringsShift bytes:
_mm_slli_si128
: Shifta
left byimm8
bytes while shifting in zeros._mm_bslli_si128
: Shifta
left byimm8
bytes while shifting in zeros._mm_bsrli_si128
: Shifta
right byimm8
bytes while shifting in zeros._mm_srli_si128
: Shifta
right byimm8
bytes while shifting in zeros.As raw bits
i1x128
/i1x256
:_mm_testz_si128
: Tests whether the specified bits in a 128-bit integer vector are all zeros._mm256_and_si256
: Compute the bitwise AND of 256 bits (representing integer data) ina
andb
._mm256_extractf128_si256
: Extract 128 bits (composed of integer data) froma
, selected withimm8
._mm_lddqu_si128
: Load 128-bits of integer data from unaligned memory.SwitchingIt makes sense for these functions to operate on generic__mm_cmpistrm
to use bytes explicitly, and rename__m128i
/__m256i
toi1x128
/i1x256
might make the library more consistent. I am not sure. I also haven't used__mm_cmpistrm
before so maybe I am wrong to think that bytes there make sense.__m128i
types because how these are interpreted by the function depends on the function arguments passed. The shift byte functions should, however, operate on bytes.Whether we can implement an
i1x128
repr(simd)
type in current Rust is a different topic (LLVM supports this, but we might need to "tweak" rustc to make it work).Thoughts?
This discussion spawned in #212 .
The text was updated successfully, but these errors were encountered: