|
35 | 35 | #include "llvm/MC/TargetRegistry.h" |
36 | 36 | #include "llvm/Support/AMDHSAKernelDescriptor.h" |
37 | 37 | #include "llvm/Support/Compiler.h" |
| 38 | +#include <bitset> |
38 | 39 |
|
39 | 40 | using namespace llvm; |
40 | 41 |
|
@@ -497,26 +498,24 @@ template <typename T> static inline T eatBytes(ArrayRef<uint8_t>& Bytes) { |
497 | 498 | return Res; |
498 | 499 | } |
499 | 500 |
|
500 | | -static inline DecoderUInt128 eat12Bytes(ArrayRef<uint8_t> &Bytes) { |
| 501 | +static inline std::bitset<96> eat12Bytes(ArrayRef<uint8_t> &Bytes) { |
| 502 | + using namespace llvm::support::endian; |
501 | 503 | assert(Bytes.size() >= 12); |
502 | | - uint64_t Lo = |
503 | | - support::endian::read<uint64_t, llvm::endianness::little>(Bytes.data()); |
| 504 | + std::bitset<96> Lo(read<uint64_t, endianness::little>(Bytes.data())); |
504 | 505 | Bytes = Bytes.slice(8); |
505 | | - uint64_t Hi = |
506 | | - support::endian::read<uint32_t, llvm::endianness::little>(Bytes.data()); |
| 506 | + std::bitset<96> Hi(read<uint32_t, endianness::little>(Bytes.data())); |
507 | 507 | Bytes = Bytes.slice(4); |
508 | | - return DecoderUInt128(Lo, Hi); |
| 508 | + return (Hi << 64) | Lo; |
509 | 509 | } |
510 | 510 |
|
511 | | -static inline DecoderUInt128 eat16Bytes(ArrayRef<uint8_t> &Bytes) { |
| 511 | +static inline std::bitset<128> eat16Bytes(ArrayRef<uint8_t> &Bytes) { |
| 512 | + using namespace llvm::support::endian; |
512 | 513 | assert(Bytes.size() >= 16); |
513 | | - uint64_t Lo = |
514 | | - support::endian::read<uint64_t, llvm::endianness::little>(Bytes.data()); |
| 514 | + std::bitset<128> Lo(read<uint64_t, endianness::little>(Bytes.data())); |
515 | 515 | Bytes = Bytes.slice(8); |
516 | | - uint64_t Hi = |
517 | | - support::endian::read<uint64_t, llvm::endianness::little>(Bytes.data()); |
| 516 | + std::bitset<128> Hi(read<uint64_t, endianness::little>(Bytes.data())); |
518 | 517 | Bytes = Bytes.slice(8); |
519 | | - return DecoderUInt128(Lo, Hi); |
| 518 | + return (Hi << 64) | Lo; |
520 | 519 | } |
521 | 520 |
|
522 | 521 | void AMDGPUDisassembler::decodeImmOperands(MCInst &MI, |
@@ -599,14 +598,14 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size, |
599 | 598 | // Try to decode DPP and SDWA first to solve conflict with VOP1 and VOP2 |
600 | 599 | // encodings |
601 | 600 | if (isGFX1250() && Bytes.size() >= 16) { |
602 | | - DecoderUInt128 DecW = eat16Bytes(Bytes); |
| 601 | + std::bitset<128> DecW = eat16Bytes(Bytes); |
603 | 602 | if (tryDecodeInst(DecoderTableGFX1250128, MI, DecW, Address, CS)) |
604 | 603 | break; |
605 | 604 | Bytes = Bytes_.slice(0, MaxInstBytesNum); |
606 | 605 | } |
607 | 606 |
|
608 | | - if (isGFX11Plus() && Bytes.size() >= 12 ) { |
609 | | - DecoderUInt128 DecW = eat12Bytes(Bytes); |
| 607 | + if (isGFX11Plus() && Bytes.size() >= 12) { |
| 608 | + std::bitset<96> DecW = eat12Bytes(Bytes); |
610 | 609 |
|
611 | 610 | if (isGFX11() && |
612 | 611 | tryDecodeInst(DecoderTableGFX1196, DecoderTableGFX11_FAKE1696, MI, |
@@ -641,7 +640,7 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size, |
641 | 640 |
|
642 | 641 | } else if (Bytes.size() >= 16 && |
643 | 642 | STI.hasFeature(AMDGPU::FeatureGFX950Insts)) { |
644 | | - DecoderUInt128 DecW = eat16Bytes(Bytes); |
| 643 | + std::bitset<128> DecW = eat16Bytes(Bytes); |
645 | 644 | if (tryDecodeInst(DecoderTableGFX940128, MI, DecW, Address, CS)) |
646 | 645 | break; |
647 | 646 |
|
|
0 commit comments