[PATCH] D57933: [WebAssembly] Fixed Disassembler ignoring endian swap on big endian.
Wouter van Oortmerssen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 7 17:44:51 PST 2019
aardappel updated this revision to Diff 185903.
aardappel added a comment.
Removed old comment.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57933/new/
https://reviews.llvm.org/D57933
Files:
lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
test/MC/Disassembler/WebAssembly/wasm.txt
Index: test/MC/Disassembler/WebAssembly/wasm.txt
===================================================================
--- test/MC/Disassembler/WebAssembly/wasm.txt
+++ test/MC/Disassembler/WebAssembly/wasm.txt
@@ -33,9 +33,7 @@
# CHECK: i64.trunc_sat_f64_u
0xFC 0x07
-# FIXME Disabled temporarily due to failures in clang-ppc64be-linux and
-# clang-s390x-linux bots
-# C HECK: v128.const 50462976, 117835012, 185207048, 252579084
+# CHECK: v128.const 50462976, 117835012, 185207048, 252579084
0xFD 0x02 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
# CHECK: v8x16.shuffle 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Index: lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
===================================================================
--- lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
+++ lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
@@ -108,9 +108,8 @@
bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
if (Size + sizeof(T) > Bytes.size())
return false;
- T Val;
- memcpy(&Val, Bytes.data() + Size, sizeof(T));
- support::endian::byte_swap<T, support::endianness::little>(Val);
+ T Val = support::endian::read<T, support::endianness::little, alignof(T)>(
+ Bytes.data() + Size);
Size += sizeof(T);
if (std::is_floating_point<T>::value) {
MI.addOperand(MCOperand::createFPImm(static_cast<double>(Val)));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57933.185903.patch
Type: text/x-patch
Size: 1465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190208/abe57809/attachment.bin>
More information about the llvm-commits
mailing list