[PATCH] D102493: [RISCV] Expand unaligned fixed-length vector memory accesses

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 19 09:37:06 PDT 2021


frasercrmck added a comment.

In D102493#2766552 <https://reviews.llvm.org/D102493#2766552>, @efriedma wrote:

> Maybe I'm missing something, but `<16 x i8>` is always aligned, right?  Can you convert a `<4 x i32>` load to a `<16 x i8>` load, and bitcast the result?

I hadn't actually considered that. It should work in theory, but we do currently have a cap on the size of the legal vector types so this wouldn't currently work with something like `<128 x i32>`. We could maybe do it pre-legalization, but I don't know if it'd get legalized right back to the unaligned version. The good news it'd presumably work for scalable vectors too. Do you know of other targets doing this?

Getting masked intrinsics to work via bitcasts may take a bit of doing though. I suppose you'd need to shuffle the indices and add on extra byte offsets like `<0,1,2,3,0,1,...>`. I don't know if that's safe to do since you may risk overflow.

@craig.topper can you see anything I've missed here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102493/new/

https://reviews.llvm.org/D102493



More information about the llvm-commits mailing list