[all-commits] [llvm/llvm-project] e45b44: [RISCV] Add pattern for PACK/PACKH in common misal...

Alex Bradbury via All-commits all-commits at lists.llvm.org
Tue Oct 1 12:10:14 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e45b44c630eb382eeb2ca8ed0fd52e973955e868
      https://github.com/llvm/llvm-project/commit/e45b44c630eb382eeb2ca8ed0fd52e973955e868
  Author: Alex Bradbury <asb at igalia.com>
  Date:   2024-10-01 (Tue, 01 Oct 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
    M llvm/test/CodeGen/RISCV/unaligned-load-store.ll

  Log Message:
  -----------
  [RISCV] Add pattern for PACK/PACKH in common misaligned load case (#110644)

PACKH is currently only selected for assembling the first two bytes of a
misligned load. A fairly complex RV32-only pattern is added for
producing PACKH+PACKH+PACK to assemble the result of a misaligned 32-bit
load.

Another pattern was added that just covers PACKH for shifted offsets 16
and 24, producing a packh and shift to replace two shifts and an 'or'.
This slightly improves RV64IZKBK for a 64-bit load, but fails to match
for the misaligned 32-bit load because the load of the upper byte is
anyext in the SelectionDAG.

I wrote the patch this way because it was quick and easy and has at
least some benefit, but the "right" approach probably merits further
discussion. Introducing target-specific SDNodes for PACK* and having
custom lowering for unaligned load/stores that introduces those nodes
them seems like it might be attractive. However, adding these patterns does provide benefit - so that's what this patch does for now.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list