[PATCH] D114581: [RISCV] Decode vtype with reserved fields to raw immediate

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 00:31:40 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG29d4230d6b52: [RISCV] Decode vtype with reserved fields to raw immediate (authored by benshi001).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114581

Files:
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
  llvm/test/MC/RISCV/rvv/vsetvl-invalid.s


Index: llvm/test/MC/RISCV/rvv/vsetvl-invalid.s
===================================================================
--- /dev/null
+++ llvm/test/MC/RISCV/rvv/vsetvl-invalid.s
@@ -0,0 +1,40 @@
+# RUN: llvm-mc -filetype=obj -triple=riscv32 %s \
+# RUN:     | llvm-objdump -d --mattr=+experimental-v - | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple=riscv64 %s \
+# RUN:     | llvm-objdump -d --mattr=+experimental-v - | FileCheck %s
+
+# CHECK: vsetvli a1, a0, e64, m1, tu, mu
+.word 0x018575d7
+
+# CHECK: vsetvli a1, a0, 28
+.word 0x01c575d7
+
+# CHECK: vsetvli a1, a0, 36
+.word 0x024575d7
+
+# CHECK: vsetvli a1, a0, 41
+.word 0x029575d7
+
+# CHECK: vsetvli a1, a0, 272
+.word 0x110575d7
+
+# CHECK: vsetvli a1, a0, e64, mf8, tu, mu
+.word 0x01d575d7
+
+# CHECK: vsetivli a1, 16, e8, m4, tu, mu
+.word 0xc02875d7
+
+# CHECK: vsetivli a1, 16, 12
+.word 0xc0c875d7
+
+# CHECK: vsetivli a1, 16, 20
+.word 0xc14875d7
+
+# CHECK: vsetivli a1, 16, 56
+.word 0xc38875d7
+
+# CHECK: vsetivli a1, 16, 259
+.word 0xd03875d7
+
+# CHECK: vsetivli a1, 16, e8, mf4, tu, mu
+.word 0xc06875d7
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
@@ -170,6 +170,14 @@
 void RISCVInstPrinter::printVTypeI(const MCInst *MI, unsigned OpNo,
                                    const MCSubtargetInfo &STI, raw_ostream &O) {
   unsigned Imm = MI->getOperand(OpNo).getImm();
+  // Print the raw immediate for reserved values: vlmul[2:0]=4, vsew[2:0]=0b1xx,
+  // or non-zero bits 8/9/10.
+  if (RISCVVType::getVLMUL(Imm) == RISCVII::VLMUL::LMUL_RESERVED ||
+      RISCVVType::getSEW(Imm) > 64 || (Imm & 0x700) != 0) {
+    O << Imm;
+    return;
+  }
+  // Print the text form.
   RISCVVType::printVType(Imm, O);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114581.390599.patch
Type: text/x-patch
Size: 1897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211130/fd1ffd6e/attachment.bin>


More information about the llvm-commits mailing list