[PATCH] D127195: [CodeEmitter] Fix encoding wide instructions on big-endian hosts

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 11:09:14 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4561352f7bd9: [CodeEmitter] Fix encoding wide instructions on big-endian hosts (authored by foad).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127195

Files:
  llvm/utils/TableGen/CodeEmitterGen.cpp


Index: llvm/utils/TableGen/CodeEmitterGen.cpp
===================================================================
--- llvm/utils/TableGen/CodeEmitterGen.cpp
+++ llvm/utils/TableGen/CodeEmitterGen.cpp
@@ -482,14 +482,12 @@
     // Emit initial function code
     if (UseAPInt) {
       int NumWords = APInt::getNumWords(BitWidth);
-      int NumBytes = (BitWidth + 7) / 8;
       o << "  const unsigned opcode = MI.getOpcode();\n"
-        << "  if (Inst.getBitWidth() != " << BitWidth << ")\n"
-        << "    Inst = Inst.zext(" << BitWidth << ");\n"
         << "  if (Scratch.getBitWidth() != " << BitWidth << ")\n"
         << "    Scratch = Scratch.zext(" << BitWidth << ");\n"
-        << "  LoadIntFromMemory(Inst, (const uint8_t *)&InstBits[opcode * "
-        << NumWords << "], " << NumBytes << ");\n"
+        << "  Inst = APInt(" << BitWidth
+        << ", makeArrayRef(InstBits + opcode * " << NumWords << ", " << NumWords
+        << "));\n"
         << "  APInt &Value = Inst;\n"
         << "  APInt &op = Scratch;\n"
         << "  switch (opcode) {\n";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127195.434894.patch
Type: text/x-patch
Size: 1071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220607/a4a6b247/attachment.bin>


More information about the llvm-commits mailing list