[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
================
@@ -160,15 +160,22 @@ def unrelated: Instruction {
// DECODER-SUPPRESS-O2-DAG: Opcode: fooTypeEncA:baz
// DECODER-SUPPRESS-O2-NOT: Opcode: bar
-// ENCODER-LABEL: static const uint64_t InstBits_DefaultMode[] = {
+// For 'bar' and 'unrelated', we didn't assign any hwmodes for them,
+// they should keep the same in the following three tables.
+// For 'foo' we assigned three hwmodes(includes 'DefaultMode')
+// it's encodings should be different in the following three tables.
+// For 'baz' we only assigned ModeB for it, to avoid empty encoding
+// we assigned the encoding of ModeB to ModeA and DefaultMode(Even though
+// they will not be used).
+// ENCODER-LABEL: static const uint64_t InstBits[] = {
// ENCODER: UINT64_C(2), // bar
-// ENCODER: UINT64_C(0), // baz
+// ENCODER: UINT64_C(12), // baz
// ENCODER: UINT64_C(8), // foo
// ENCODER: UINT64_C(2), // unrelated
// ENCODER-LABEL: static const uint64_t InstBits_ModeA[] = {
// ENCODER: UINT64_C(2), // bar
-// ENCODER: UINT64_C(0), // baz
+// ENCODER: UINT64_C(12), // baz
----------------
nvjle wrote:
It doesn't make sense to me to assign the encoding of a different mode for these unused entries. Why don't we leave them as zeroes as they originally were? In theory it doesn't matter, but it seems confusing to assign a non-zero value from some other mode. Also, for downstream back ends with any failures, diff'ing the original and new emitted files will have fewer "irrelevant" differences.
https://github.com/llvm/llvm-project/pull/88377
More information about the llvm-commits
mailing list