Skip to content

_mm_loadl_epi64 doesn't allow reads aligned to 8-byte boundaries #582

Description

@brian-armstrong

std::arch::x86_64::_mm_loadl_epi64 is kind of a weird case. Intel guides say it takes a *const __m128i, but the documentation is unclear on whether this needs to be aligned https://software.intel.com/en-us/node/524242 Note that load (must be aligned) and loadu (need not be aligned) are defined while loadl isn't. I believe the correct definition is that it need be aligned, but only to an 8-byte boundary (instead of the full 16) but I haven't been able to find documentation backing this up.

Clang's intrinsics header actually does go out of its way to allow this to be aligned to an 8-byte boundary, not a 16-byte boundary https://github.com/llvm-mirror/clang/blob/master/lib/Headers/emmintrin.h#L3587

This instruction produces the expected result on a 8- but not 16-byte aligned pointer in clang, but yields a segmentation fault on the same class of pointer in Rust.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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