[all-commits] [llvm/llvm-project] c95935: [RISCV] Directly use pack* in build_vector lowerin...

Philip Reames via All-commits all-commits at lists.llvm.org
Mon Jul 8 16:10:46 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c95935789da9349c470ce75203af93624360b2b6
      https://github.com/llvm/llvm-project/commit/c95935789da9349c470ce75203af93624360b2b6
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2024-07-08 (Mon, 08 Jul 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll

  Log Message:
  -----------
  [RISCV] Directly use pack* in build_vector lowering (#98084)

In 03d4332, we extended build_vector lowering to pack elements into the
largest size which doesn't exceed either ELEN or XLEN. The zbkb
extension - ratified under scalar crypto, but otherwise not really
connected to crypto per se - adds the packh, packw, and pack
instructions. These instructions are designed for exactly this pairwise
packing.

I ended up choosing to directly lower to machine nodes. A combination of
the slightly non-uniform semantics of these instructions (packw *sign*
extends the result, whereas packh *zero* extends it), and our generic
dag canonicalization (which sinks shl through or nodes), make pattern
matching these tricky and not particularly robust. Another alternative
was to have an ISD node for them, but that didn't seem to add much in
practice.



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