[llvm] [TableGen] Use bitwise operations to access HwMode ID. (PR #88377)

Jason Eckhardt via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 20:43:51 PDT 2024


================
@@ -178,18 +185,53 @@ def unrelated: Instruction {
 // ENCODER:         UINT64_C(3),        // foo
 // ENCODER:         UINT64_C(2),        // unrelated
 
-// ENCODER:  unsigned HwMode = STI.getHwMode();
-// ENCODER:  switch (HwMode) {
-// ENCODER:  default: llvm_unreachable("Unknown hardware mode!"); break;
-// ENCODER:  case 0: InstBits = InstBits_DefaultMode; break;
-// ENCODER:  case 1: InstBits = InstBits_ModeA; break;
-// ENCODER:  case 2: InstBits = InstBits_ModeB; break;
-// ENCODER:  };
-
-// ENCODER:     case ::foo: {
-// ENCODER:      switch (HwMode) {
-// ENCODER:      default: llvm_unreachable("Unhandled HwMode");
----------------
nvjle wrote:

Please add one more hardware mode `ModeC` and use it in one of the `EncodingInfos` (or add a new unit test file altogether). The reason why will be clear later in this review where I discuss the emitter code that generates the above-- and it would only show if there is at least one more mode.

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


More information about the llvm-commits mailing list