Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Question: SSSE3 #79

@easyaspi314

Description

@easyaspi314

HighwayHash can easily be adapted to SSSE3 with only a few changes:

  1. Remove the min, max, and stream functions in vector128.h. We don't use them.
  2. Change V128<uint64_t>::operator== to this:
  // There are no greater-than comparison instructions for unsigned T.
  HH_INLINE V128 operator==(const V128& other) const {
#ifdef __SSE4_1__
    return V128(_mm_cmpeq_epi64(v_, other.v_));
#else 
    // Do a 32-bit equality comparison, then AND the high bits and the low bits. If the
    // vectors are equal, the result will be
    //    0xFFFFFFFFFFFFFFFF & 0xFFFFFFFFFFFFFFFF == 0xFFFFFFFFFFFFFFFF
    // and if not, it will be
    //    0xFFFFFFFF00000000 & 0x00000000FFFFFFFF = 0x0000000000000000
    __m128i cmp = _mm_cmpeq_epi32(v_, other.v_);
    return V128(_mm_and_si128(cmp, _mm_shuffle_epi32(cmp, _MM_SHUFFLE(2, 3, 0, 1))));
#endif
  }
  1. Change the _mm_insert_epi32 in HHStateSSE41::UpdateRemainder to this:
      packetH = V2x64U(_mm_insert_epi16(_mm_insert_epi16(packetH, last4 & 0xFFFF, 6), last4 >> 16, 7));
  1. Change the second _mm_insert_epi32 in HHStateSSE41::XorByShift128Left12 to this:
    const V2x64U sign_bit128(_mm_insert_epi16(zero, 0x8000u, 7));

Done.

If we add it, the only issue I see is what do we name it, and what do we do with the SSE41 target?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions