Cast operators missing.

Issue #8 open
edanor repo owner created an issue

Every specialized vector type should implement a conversion operator.

Unit tests are needed to make sure all operators are correct.

Comments (7)

  1. edanor reporter

    Added empty ITOF and UTOF to float classes as well as some unit tests. Actual code is still missing.

    While ITOF/UTOF construction will be desired mode of use, these operations should be provided as part of the interface.

    Inverse conversion, that is FTOI/FTOU might not be possible as part of signed/unsigned classes because of delayed definition of float types.

  2. edanor reporter

    Cast operators should be placed in specialization class files:

    • UTOI/ITOU in integer specializations
    • ITOF/FTOI/UTOF/FTOU in float specializations
  3. edanor reporter

    Cast operators cannot be implemented as part of the interface, because they are dependent on currently not defined data types. Each plugin now defines UMESimdCastOperators<plugin>.h file which is a placeholder for specialized cast operators.

    Added cast operators for: SCALAR, AVX, AVX2 and KNC. Support still missing for AVX512.

  4. edanor reporter
    • changed status to open

    Cast operators should be defined for all vector types as part of following types:

    Base type casts (no vector length change, no precision change):

    Unsigned vectors:
    UTOI - cast unsigned vector to signed integer vector
    UTOF - cast unsigned vector to float vector

    Signed vectors:
    ITOU - cast signed vector to unsigned vector ITOF - cast signed vector to float vector

    Float vectors: FTOU - cast float vector to unsigned vector FTOI - cast float vector to signed vector

    Example: SIMDVec4_32i will convert into SIMDVec4_32u (ITOU) or SIMDVec4_32f (ITOF)

    Vector length altering casts: PACK - assemble vector using two half-length vectors
    PACKLO - insert half-length vector into lower half of the vector
    PACKHI - insert half-length vector into upper half of the vector

    UNPACK - extract upper and lower halves of the vector into half-length vectors
    UNPACKLO - extract lower half of the vector into a half-length vector
    UNPACKHI - extract higher half of the vector into a half-length vector

    Example: SIMDVec4_32f will unpack into 2 SIMDVec2_32f vectors.

    Precision altering casts:
    DEGRADE - change rank of all scalar elements into lower (e.g. SIMDVec4_64u will be converted to SIMDVec4_32u)
    PROMOTE - change rank of all scalar elements into higher (e.g. SIMDVec4_16i will be converted to SIMDVec4_16i)

    Status:
    - for base type casts there are unit tests already, and casts are implemented
    - for vector altering casts, there are no unit tests, but casts are implemented
    - for precision altering casts there are no unit tests nor implementation.

    These three classes of casts are a preliminary step for defining all type conversions, e.g. SIMD4_64f to SIMD16_8u.

  5. Log in to comment