[PATCH] D117389: [RISCV] Improve extract_vector_elt for fixed mask registers.

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 25 02:12:47 PST 2022


frasercrmck added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:4260
+    if (VecVT.isFixedLengthVector()) {
+      unsigned Nums = VecVT.getVectorMinNumElements();
+      if (Nums >= 8) {
----------------
nit: `Nums` is a little unconventional. `NumElts` or something? You can also use `getVectorNumElements` because we know it's a fixed-length vector.


================
Comment at: llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract-i1.ll:5
 
+; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+experimental-v,+zfh,+f,+d,+zbs -riscv-v-vector-bits-min=128 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32ZBS
+; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+experimental-v,+zfh,+f,+d,+zbs -riscv-v-vector-bits-min=128 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64ZBS
----------------
You'll need to rebase and swap `+experimental-v` for `+v`


================
Comment at: llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract-i1.ll:272
+; RV32-NEXT:    vmv.x.s a0, v8
+; RV32-NEXT:    srl a0, a0, a1
+; RV32-NEXT:    andi a0, a0, 1
----------------
This doesn't look like it's doing the right thing. We haven't modified the original extract index `a1` at this point so we could be shifting an `i32` right by up to 127 places? Have I missed something?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117389



More information about the llvm-commits mailing list