[llvm] [RISCV] Move vendor extensions after standard extensions in RISCVDisassembler::getInstruction16. (PR #130821)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 11 12:53:45 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

All of the vendor extensions should be mutex with the standard extensions based on the incompatible extension checks in RISCVISAInfo.cpp. There is one missing check that will be fixed by #<!-- -->130816.

I'll make a similar patch for the 32-bit table, but I need to do more auditing first.

---
Full diff: https://github.com/llvm/llvm-project/pull/130821.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp (+10-8) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
index de742ac428de2..857cca31b62cd 100644
--- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
@@ -736,14 +736,7 @@ DecodeStatus RISCVDisassembler::getInstruction16(MCInst &MI, uint64_t &Size,
 
   uint32_t Insn = support::endian::read16le(Bytes.data());
 
-  TRY_TO_DECODE_FEATURE_ANY(XqciFeatureGroup, DecoderTableXqci16,
-                            "Qualcomm uC 16bit");
-  TRY_TO_DECODE_FEATURE(
-      RISCV::FeatureVendorXqccmp, DecoderTableXqccmp16,
-      "Xqccmp (Qualcomm 16-bit Push/Pop & Double Move Instructions)");
-  TRY_TO_DECODE_AND_ADD_SP(STI.hasFeature(RISCV::FeatureVendorXwchc),
-                           DecoderTableXwchc16, "WCH QingKe XW");
-
+  // Standard Extensions
   // DecoderTableZicfiss16 must be checked before DecoderTable16.
   TRY_TO_DECODE(true, DecoderTableZicfiss16, "RVZicfiss (Shadow Stack)");
   TRY_TO_DECODE_AND_ADD_SP(true, DecoderTable16,
@@ -754,6 +747,15 @@ DecodeStatus RISCVDisassembler::getInstruction16(MCInst &MI, uint64_t &Size,
   TRY_TO_DECODE(true, DecoderTableZcOverlap16,
                 "ZcOverlap (16-bit Instructions overlapping with Zcf/Zcd)");
 
+  // Vendor Extensions
+  TRY_TO_DECODE_FEATURE_ANY(XqciFeatureGroup, DecoderTableXqci16,
+                            "Qualcomm uC 16bit");
+  TRY_TO_DECODE_FEATURE(
+      RISCV::FeatureVendorXqccmp, DecoderTableXqccmp16,
+      "Xqccmp (Qualcomm 16-bit Push/Pop & Double Move Instructions)");
+  TRY_TO_DECODE_AND_ADD_SP(STI.hasFeature(RISCV::FeatureVendorXwchc),
+                           DecoderTableXwchc16, "WCH QingKe XW");
+
   return MCDisassembler::Fail;
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/130821


More information about the llvm-commits mailing list