[CodeEmitter] Fix encoding wide instructions on big-endian hosts
authorJay Foad <jay.foad@amd.com>
Tue, 7 Jun 2022 09:41:50 +0000 (10:41 +0100)
committerJay Foad <jay.foad@amd.com>
Tue, 7 Jun 2022 18:06:28 +0000 (19:06 +0100)
commit4561352f7bd972939f19d7ff8462386c97b584ad
tree29c9637575897d19ee39c63162481e9cc0d177d8
parentbccbf5276e6ee23a427b48d80ad42ff31575c1e7
[CodeEmitter] Fix encoding wide instructions on big-endian hosts

For instructions wider than 64 bits the InstBits table is initialized in
64-bit chunks from APInt::getRawData, but it was being read with
LoadIntFromMemory which is byte-based.

Fix this by reading the table with the APInt constructor that takes an
ArrayRef to the raw data instead.

This is currently NFC for in-tree targets but fixes AMDGPU failures on
big-endian hosts that were caused by D126483 until it was reverted.

Differential Revision: https://reviews.llvm.org/D127195
llvm/utils/TableGen/CodeEmitterGen.cpp