aarch64: use read_unaligned for vld1_*
#2004
Open
+326
−1,772
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The custom intrinsics for
vld1_*optimize less well than a standard unaligned read.https://rust.godbolt.org/z/8T6Kr63K4
That seems like something that should be fixed in LLVM, it should be able to eliminate this store to an alloca:
But for now we can fix it here. The only problem is how to test it. Maybe there is some clever way in the
ymlformat, but the issue is that some vector sizes useldp, others useldr. I don't currently see a way to encode that nicely. I have it on good authority (by an arm engineer), that there is no readon to preferld1over twoldps.This was found in
fearless_simd, @Shnatsel and I went on a bughunt, and finally found the cause for their weird codegen in a read that first dereferenced a reference to an array. There is some extra context here linebender/fearless_simd#185 (comment).cc @adamgemmell @CrooseGit if I'm missing anything, and if we can find a proper way to test this (or just accept testing for
ldand not specifying the exact instruction).edit: also I can't find anywhere whether the intrinsic assumes an aligned pointer or not, so maybe we should be using
core::ptr::readinstead?