[PATCH] D127195: [CodeEmitter] Fix encoding wide instructions on big-endian hosts
Min-Yih Hsu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 10:32:21 PDT 2022
myhsu accepted this revision.
myhsu added a comment.
This revision is now accepted and ready to land.
This is an interesting bug!
I was actually scratching my head wondering why m68k hasn't encountered this issue, before realizing that this problem only happens in fixed length CodeEmitter.
It seems like this patch can be tested by existing test cases, but just curious, do we have any big-endian builtbot for AMDGPU?
================
Comment at: llvm/utils/TableGen/CodeEmitterGen.cpp:488
<< " Scratch = Scratch.zext(" << BitWidth << ");\n"
- << " LoadIntFromMemory(Inst, (const uint8_t *)&InstBits[opcode * "
- << NumWords << "], " << NumBytes << ");\n"
+ << " Inst = APInt(" << BitWidth
+ << ", makeArrayRef(InstBits + opcode * " << NumWords << ", " << NumWords
----------------
foad wrote:
> This could conceivably slow things down by constructing a new APInt instead of modifying the existing one in-place, but I think it's more important to make sure it works correctly before addressing that.
I'm fine with the current syntax too, if performance is really a problem, we can always write a simple loop to copy data into the pointer returned by `APInt::getRawData`, though getRawData returned a constant pointer right now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127195/new/
https://reviews.llvm.org/D127195
More information about the llvm-commits
mailing list