[llvm] [GlobalISel][TableGen] Support for typed G_FCONSTANT Imm in MIR-patttern (PR #219563)
Vikash Gupta via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 02:06:14 PDT 2026
https://github.com/vg0204 updated https://github.com/llvm/llvm-project/pull/219563
>From ec4f9c12da68e28b97805d477fea88b9e5ec0b8b Mon Sep 17 00:00:00 2001
From: vg0204 <Vikash.Gupta at amd.com>
Date: Sat, 29 Aug 2026 03:56:17 +0530
Subject: [PATCH 1/5] [GlobalISel][TableGen] Support typed G_FCONSTANT Imm in
MIR-patttern
GlobalISel MIR combine patterns can already build a typed integer
constant directly in an apply pattern, e.g. `(apply (G_CONSTANT $dst,
(GITypeOf<"$dst"> 0)))`. The same was not possible for `G_FCONSTANT`:
writing a typed literal on it silently producing invalid MIR, since the
immediate was routed through the path meant for register operands rather
than being emitted as a floating-point immediate.
This patch extends that support to `G_FCONSTANT`, letting typed
float-constant patterns be written declaratively and type-derived via
`GITypeOf` just like the integer case, instead of falling back to
hand-written C++ combine code or hitting the bad-MIR bug.
This is a prerequisite for migrating existing `wip_match_opcode`
combines that replace a matched value with a float constant of its
own type into pure MIR patterns.
---
llvm/docs/GlobalISel/MIRPatterns.md | 16 +++++++
.../CodeGen/GlobalISel/GIMatchTableExecutor.h | 8 ++++
.../GlobalISel/GIMatchTableExecutorImpl.h | 21 +++++++++
.../match-table-typeof-fconstant.td | 46 +++++++++++++++++++
.../Common/GlobalISel/MatchTable/Matchers.cpp | 5 +-
.../Common/GlobalISel/MatchTable/Matchers.h | 11 +++--
.../TableGen/GlobalISelCombinerEmitter.cpp | 21 +++++++--
7 files changed, 120 insertions(+), 8 deletions(-)
create mode 100644 llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td
diff --git a/llvm/docs/GlobalISel/MIRPatterns.md b/llvm/docs/GlobalISel/MIRPatterns.md
index 8253edf463562..e3873f9211ca2 100644
--- a/llvm/docs/GlobalISel/MIRPatterns.md
+++ b/llvm/docs/GlobalISel/MIRPatterns.md
@@ -449,6 +449,12 @@ There is of course a special case for `G_CONSTANT`. Immediates for
`G_CONSTANT` must always be typed, and a CImm is added
(`MachineInstrBuilder::addCImm`).
+`G_FCONSTANT` is handled the same way: immediates for `G_FCONSTANT` must
+always be typed, and an FP immediate is added (`MachineInstrBuilder::addFPImm`).
+Since the pattern grammar has no fp literals, the integer literal is
+interpreted as a floating-point value (0 -> 0.0, -1 -> -1.0); non-integer
+values such as 0.5 cannot be expressed today.
+
```{code-block} text
:caption: 'Constant Emission Examples:'
@@ -475,6 +481,16 @@ def Bux : GICombineRule<
(defs root:$dst),
(match (G_FOO $dst, $src)),
(apply (G_CONSTANT $dst, (i32 0)))>;
+
+// GITypeOf can be combined with this to reuse an already-matched register's
+// type instead of hardcoding one, which is handy when replacing the root:
+//
+// Example output:
+// %dst = G_FCONSTANT float 0.0
+def Baz : GICombineRule<
+ (defs root:$dst),
+ (match (G_FOO $dst, $src)),
+ (apply (G_FCONSTANT $dst, (GITypeOf<"$dst"> 0)))>;
```
### GICombinePatFrag
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
index 6e3ccf1923c40..ba6f90a125707 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
@@ -489,6 +489,14 @@ enum {
/// - Imm(8) - The immediate to add
GIR_AddCImm,
+ /// Add a floating-point immediate to the specified instruction.
+ /// The immediate is interpreted as a floating-point value (a double) and
+ /// converted to the semantics matching Ty before being attached.
+ /// - InsnID(ULEB128) - Instruction ID to modify
+ /// - Ty(1) - Type of the constant immediate.
+ /// - Imm(8) - The immediate (interpreted as a double) to add
+ GIR_AddCFPImm,
+
/// Render complex operands to the specified instruction
/// - InsnID(ULEB128) - Instruction ID to modify
/// - RendererID(2) - The renderer to call
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
index fdedd452448f5..d356f82ae6960 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
@@ -20,6 +20,7 @@
#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
+#include "llvm/CodeGen/LowLevelTypeUtils.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
@@ -1334,6 +1335,26 @@ bool GIMatchTableExecutor::executeMatchTable(
break;
}
+ case GIR_AddCFPImm: {
+ uint64_t InsnID = readULEB();
+ int TypeID = readS8();
+ uint64_t Imm = readU64();
+ assert(OutMIs[InsnID] && "Attempted to add to undefined instruction");
+
+ LLT Ty = ExecInfo.TypeObjects[TypeID];
+ LLVMContext &Ctx = MF->getFunction().getContext();
+ APFloat APF(static_cast<double>(static_cast<int64_t>(Imm)));
+ bool Ignored;
+ APF.convert(getFltSemanticForLLT(Ty.getScalarType()),
+ APFloat::rmNearestTiesToEven, &Ignored);
+ OutMIs[InsnID].addFPImm(ConstantFP::get(Ctx, APF));
+ DEBUG_WITH_TYPE(TgtExecutor::getName(),
+ dbgs() << CurrentIdx << ": GIR_AddCFPImm(OutMIs["
+ << InsnID << "], TypeID=" << TypeID
+ << ", Imm=" << Imm << ")\n");
+ break;
+ }
+
case GIR_ComplexRenderer: {
uint64_t InsnID = readULEB();
uint16_t RendererID = readU16();
diff --git a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td
new file mode 100644
index 0000000000000..56da3de3acc74
--- /dev/null
+++ b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td
@@ -0,0 +1,46 @@
+// RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
+// RUN: -combiners=MyCombiner %s | \
+// RUN: FileCheck %s
+
+include "llvm/Target/Target.td"
+include "llvm/Target/GlobalISel/Combine.td"
+
+def MyTargetISA : InstrInfo;
+def MyTarget : Target { let InstructionSet = MyTargetISA; }
+
+// G_FCONSTANT, like G_CONSTANT, can be built directly in an apply pattern
+// with a GITypeOf-typed literal. The literal is interpreted as a
+// floating-point value (the pattern grammar has no fp literals).
+def Test0 : GICombineRule<
+ (defs root:$dst),
+ (match (G_FNEG $t, $src),
+ (G_FNEG $dst, $t)),
+ (apply (G_FCONSTANT $dst, (GITypeOf<"$dst"> 0)))>;
+
+// CHECK: const uint8_t *GenMyCombiner::getMatchTable() const {
+// CHECK-NEXT: constexpr static uint8_t MatchTable0[] = {
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 0*/ GIMT_Encode4([[L34:[0-9]+]]), // Rule ID 0 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
+// CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FNEG),
+// CHECK-NEXT: // MIs[0] dst
+// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
+// CHECK-NEXT: // MIs[0] t
+// CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
+// CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FNEG),
+// CHECK-NEXT: // MIs[1] src
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: GIM_CheckIsSafeToFold, /*NumInsns*/1,
+// CHECK-NEXT: // Combiner Rule #0: Test0
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // dst
+// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(0),
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 0: @[[L34]]
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: }; // Size: {{[0-9]+}} bytes
+// CHECK-NEXT: return MatchTable0;
+// CHECK-NEXT: }
+
+def MyCombiner: GICombiner<"GenMyCombiner", [
+ Test0
+]>;
diff --git a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
index cc1089fc316c7..656ab5379fc11 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
+++ b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
@@ -1846,8 +1846,9 @@ void ImmRenderer::emitRenderOpcodes(MatchTable &Table) const {
if (CImmLLT) {
assert(Table.isCombiner() &&
"ConstantInt immediate are only for combiners!");
- Table << MatchTable::Opcode("GIR_AddCImm") << MatchTable::Comment("InsnID")
- << MatchTable::ULEB128Value(InsnID) << MatchTable::Comment("Type");
+ Table << MatchTable::Opcode(IsFP ? "GIR_AddCFPImm" : "GIR_AddCImm")
+ << MatchTable::Comment("InsnID") << MatchTable::ULEB128Value(InsnID)
+ << MatchTable::Comment("Type");
emitType(Table, *CImmLLT);
Table << MatchTable::Comment("Imm") << MatchTable::IntValue(8, Imm)
<< MatchTable::LineBreak;
diff --git a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
index b7ea01279eea9..63c3b09272fbe 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
+++ b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
@@ -2032,19 +2032,24 @@ class TempRegRenderer : public OperandRenderer {
};
/// Adds a specific immediate to the instruction being built.
-/// If a LLT is passed, a ConstantInt immediate is created instead.
+/// If a LLT is passed, a ConstantInt immediate is created instead, unless
+/// IsFP is set, in which case the immediate is interpreted as a
+/// floating-point value (a double) and a ConstantFP immediate is created.
class ImmRenderer : public OperandRenderer {
protected:
unsigned InsnID;
int64_t Imm;
std::optional<LLTCodeGenOrTempType> CImmLLT;
+ bool IsFP = false;
public:
ImmRenderer(unsigned InsnID, int64_t Imm)
: OperandRenderer(OR_Imm), InsnID(InsnID), Imm(Imm) {}
- ImmRenderer(unsigned InsnID, int64_t Imm, const LLTCodeGenOrTempType &CImmLLT)
- : OperandRenderer(OR_Imm), InsnID(InsnID), Imm(Imm), CImmLLT(CImmLLT) {
+ ImmRenderer(unsigned InsnID, int64_t Imm, const LLTCodeGenOrTempType &CImmLLT,
+ bool IsFP = false)
+ : OperandRenderer(OR_Imm), InsnID(InsnID), Imm(Imm), CImmLLT(CImmLLT),
+ IsFP(IsFP) {
if (CImmLLT.isLLTCodeGen())
KnownTypes.insert(CImmLLT.getLLTCodeGen());
}
diff --git a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
index bb93d0248e55f..5b05ba24d77f8 100644
--- a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
@@ -2130,12 +2130,15 @@ bool CombineRuleBuilder::emitCodeGenInstructionApplyImmOperand(
RuleMatcher &M, BuildMIAction &DstMI, const CodeGenInstructionPattern &P,
const InstructionOperand &O) {
// If we have a type, we implicitly emit a G_CONSTANT, except for G_CONSTANT
- // itself where we emit a CImm.
+ // itself (which needs a CImm) and G_FCONSTANT (which needs an FP immediate,
+ // the literal being interpreted as a floating-point value since the
+ // pattern grammar has no fp literals).
//
// No type means we emit a simple imm.
- // G_CONSTANT is a special case and needs a CImm though so this is likely a
- // mistake.
+ // G_CONSTANT/G_FCONSTANT are special cases and need a typed immediate
+ // though so this is likely a mistake.
const bool isGConstant = P.is("G_CONSTANT");
+ const bool isGFConstant = P.is("G_FCONSTANT");
const auto Ty = O.getType();
if (!Ty) {
if (isGConstant) {
@@ -2145,6 +2148,13 @@ bool CombineRuleBuilder::emitCodeGenInstructionApplyImmOperand(
return false;
}
+ if (isGFConstant) {
+ PrintError("'G_FCONSTANT' immediate must be typed!");
+ PrintNote("while emitting pattern '" + P.getName() + "' (" +
+ P.getInstName() + ")");
+ return false;
+ }
+
DstMI.addRenderer<ImmRenderer>(O.getImmValue());
return true;
}
@@ -2158,6 +2168,11 @@ bool CombineRuleBuilder::emitCodeGenInstructionApplyImmOperand(
return true;
}
+ if (isGFConstant) {
+ DstMI.addRenderer<ImmRenderer>(O.getImmValue(), *ImmTy, /*IsFP=*/true);
+ return true;
+ }
+
unsigned TempRegID = M.allocateTempRegID();
// Ensure MakeTempReg & the BuildConstantAction occur at the beginning.
auto InsertIt = M.insertAction<MakeTempRegisterAction>(M.actions_begin(),
>From 6aec12572f48d35a3d79a503aa1a5118fab0e096 Mon Sep 17 00:00:00 2001
From: vg0204 <Vikash.Gupta at amd.com>
Date: Sat, 29 Aug 2026 14:57:08 +0530
Subject: [PATCH 2/5] Added match-table & pattern error tests for G_FCONSTANT
---
llvm/docs/GlobalISel/MIRPatterns.md | 9 +++-
.../match-table-imms.td | 54 +++++++++++++------
.../pattern-errors.td | 8 +++
3 files changed, 55 insertions(+), 16 deletions(-)
diff --git a/llvm/docs/GlobalISel/MIRPatterns.md b/llvm/docs/GlobalISel/MIRPatterns.md
index e3873f9211ca2..fe9806f2042f7 100644
--- a/llvm/docs/GlobalISel/MIRPatterns.md
+++ b/llvm/docs/GlobalISel/MIRPatterns.md
@@ -482,12 +482,19 @@ def Bux : GICombineRule<
(match (G_FOO $dst, $src)),
(apply (G_CONSTANT $dst, (i32 0)))>;
+// Example output:
+// %dst = G_FCONSTANT float 4.200000e+01
+def Baz : GICombineRule<
+ (defs root:$dst),
+ (match (G_FOO $dst, $src)),
+ (apply (G_FCONSTANT $dst, (f32 42)))>;
+
// GITypeOf can be combined with this to reuse an already-matched register's
// type instead of hardcoding one, which is handy when replacing the root:
//
// Example output:
// %dst = G_FCONSTANT float 0.0
-def Baz : GICombineRule<
+def Qux : GICombineRule<
(defs root:$dst),
(match (G_FOO $dst, $src)),
(apply (G_FCONSTANT $dst, (GITypeOf<"$dst"> 0)))>;
diff --git a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
index e0b802447ea2a..33f13625ec36b 100644
--- a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
+++ b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
@@ -26,20 +26,30 @@ def CImmInstTest1 : GICombineRule<
(match (G_CONSTANT $a, (i32 0))),
(apply (G_CONSTANT $a, (i32 42)))>;
+// emits a CFPImm because G_FCONSTANT is a special case, like G_CONSTANT. The
+// literal is interpreted as a floating-point value (the pattern grammar has
+// no fp literals), so 42 means 42.0 here.
+def FPImmInstTest1 : GICombineRule<
+ (defs root:$a),
+ (match (G_FCONSTANT $a, (f32 0))),
+ (apply (G_FCONSTANT $a, (f32 42)))>;
+
def MyCombiner: GICombiner<"GenMyCombiner", [
InstTest0,
InstTest1,
- CImmInstTest1
+ CImmInstTest1,
+ FPImmInstTest1
]>;
// CHECK: const uint8_t *GenMyCombiner::getMatchTable() const {
// CHECK-NEXT: constexpr static uint8_t MatchTable0[] = {
-// CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 3*/ GIMT_Encode4([[L579:[0-9]+]]),
-// CHECK-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4([[L462:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4([[L493:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_ZEXT*//*Label 2*/ GIMT_Encode4({{[0-9]+}}),
-// CHECK-NEXT: // Label 0: @[[L462]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 4*/ GIMT_Encode4([[L492:[0-9]+]]), // Rule ID 0 //
+// CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 4*/ GIMT_Encode4([[L690:[0-9]+]]),
+// CHECK-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4([[L550:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4([[L575:[0-9]+]]),
+// CHECK-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4([[L615:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4([[L655:[0-9]+]]),
+// CHECK-NEXT: // Label 0: @[[L550]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 5*/ GIMT_Encode4([[L574:[0-9]+]]), // Rule ID 0 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
// CHECK-NEXT: // MIs[0] a
@@ -50,10 +60,10 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 4: @[[L492]]
+// CHECK-NEXT: // Label 5: @[[L574]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 1: @[[L493]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 5*/ GIMT_Encode4([[L538:[0-9]+]]), // Rule ID 2 //
+// CHECK-NEXT: // Label 1: @[[L575]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 6*/ GIMT_Encode4([[L614:[0-9]+]]), // Rule ID 2 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
// CHECK-NEXT: // MIs[0] a
@@ -64,10 +74,24 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 5: @[[L538]]
+// CHECK-NEXT: // Label 6: @[[L614]]
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 2: @[[L615]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4([[L654:[0-9]+]]), // Rule ID 3 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
+// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
+// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// CHECK-NEXT: // Combiner Rule #3: FPImmInstTest1
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 7: @[[L654]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 2: @{{[0-9]+}}
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 6*/ GIMT_Encode4([[L578:[0-9]+]]), // Rule ID 1 //
+// CHECK-NEXT: // Label 3: @[[L655]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4([[L689:[0-9]+]]), // Rule ID 1 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
// CHECK-NEXT: // MIs[0] a
// CHECK-NEXT: // No operand predicates
@@ -80,9 +104,9 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 6: @[[L578]]
+// CHECK-NEXT: // Label 8: @[[L689]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 3: @[[L579]]
+// CHECK-NEXT: // Label 4: @[[L690]]
// CHECK-NEXT: GIM_Reject,
// CHECK-NEXT: }; // Size: {{[0-9]+}} bytes
// CHECK-NEXT: return MatchTable0;
diff --git a/llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td b/llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td
index 4f1b4283458ba..5abfd02b6ffee 100644
--- a/llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td
+++ b/llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td
@@ -174,6 +174,13 @@ def output_imm_must_be_typed : GICombineRule<
(match (COPY $x, (i32 0)):$d),
(apply (G_CONSTANT $x, 0):$d)>;
+// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: 'G_FCONSTANT' immediate must be typed!
+// CHECK: :[[@LINE+1]]:{{[0-9]+}}: note: while emitting pattern 'd' (G_FCONSTANT)
+def output_fpimm_must_be_typed : GICombineRule<
+ (defs root:$x),
+ (match (COPY $x, (f32 0)):$d),
+ (apply (G_FCONSTANT $x, 0):$d)>;
+
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: 'G_BUILD_VECTOR' expected at least 2 operands, got 1
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Failed to parse pattern: '(G_BUILD_VECTOR ?:$x)'
def too_few_ops_for_variadic : GICombineRule<
@@ -339,6 +346,7 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
bad_imm_not_a_valuetype,
output_imm_cannot_be_named,
output_imm_must_be_typed,
+ output_fpimm_must_be_typed,
too_few_ops_for_variadic,
expected_op_name,
bad_mo_type_not_a_valuetype,
>From 89ab68251bf972349b592d53a7119887cf98e229 Mon Sep 17 00:00:00 2001
From: vg0204 <Vikash.Gupta at amd.com>
Date: Wed, 2 Sep 2026 16:13:24 +0530
Subject: [PATCH 3/5] [GlobalISel][TableGen] Encode G_FCONSTANT immediates as
IEEE bit patterns
We treat the integer as the IEEE bit pattern of the immediate's type
instead, building APFloat from APInt the same way GIR_AddCImm builds
ConstantInt.
Also, fold the G_FCONSTANT coverage into match-table-imms.td (f32,
f64, GITypeOf zero, and a non-zero fractional bit pattern).
---
llvm/docs/GlobalISel/MIRPatterns.md | 10 +-
.../CodeGen/GlobalISel/GIMatchTableExecutor.h | 6 +-
.../GlobalISel/GIMatchTableExecutorImpl.h | 6 +-
.../match-table-imms.td | 219 ++++++++++++------
.../match-table-typeof-fconstant.td | 46 ----
.../Common/GlobalISel/MatchTable/Matchers.h | 4 +-
.../TableGen/GlobalISelCombinerEmitter.cpp | 6 +-
7 files changed, 162 insertions(+), 135 deletions(-)
delete mode 100644 llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td
diff --git a/llvm/docs/GlobalISel/MIRPatterns.md b/llvm/docs/GlobalISel/MIRPatterns.md
index fe9806f2042f7..3b0f41a27f984 100644
--- a/llvm/docs/GlobalISel/MIRPatterns.md
+++ b/llvm/docs/GlobalISel/MIRPatterns.md
@@ -451,9 +451,9 @@ There is of course a special case for `G_CONSTANT`. Immediates for
`G_FCONSTANT` is handled the same way: immediates for `G_FCONSTANT` must
always be typed, and an FP immediate is added (`MachineInstrBuilder::addFPImm`).
-Since the pattern grammar has no fp literals, the integer literal is
-interpreted as a floating-point value (0 -> 0.0, -1 -> -1.0); non-integer
-values such as 0.5 cannot be expressed today.
+Since the pattern grammar has no fp literals, the integer is the IEEE bit
+pattern of that type (`0` is `+0.0` for every FP width; `0x3f800000` is `1.0`
+as `f32`).
```{code-block} text
:caption: 'Constant Emission Examples:'
@@ -483,11 +483,11 @@ def Bux : GICombineRule<
(apply (G_CONSTANT $dst, (i32 0)))>;
// Example output:
-// %dst = G_FCONSTANT float 4.200000e+01
+// %dst = G_FCONSTANT float 1.000000e+00
def Baz : GICombineRule<
(defs root:$dst),
(match (G_FOO $dst, $src)),
- (apply (G_FCONSTANT $dst, (f32 42)))>;
+ (apply (G_FCONSTANT $dst, (f32 0x3f800000)))>;
// GITypeOf can be combined with this to reuse an already-matched register's
// type instead of hardcoding one, which is handy when replacing the root:
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
index ba6f90a125707..8d663880f8a1e 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
@@ -490,11 +490,11 @@ enum {
GIR_AddCImm,
/// Add a floating-point immediate to the specified instruction.
- /// The immediate is interpreted as a floating-point value (a double) and
- /// converted to the semantics matching Ty before being attached.
+ /// Imm is the IEEE bit pattern of a value with Ty's scalar semantics; it is
+ /// not converted from an integer or a double.
/// - InsnID(ULEB128) - Instruction ID to modify
/// - Ty(1) - Type of the constant immediate.
- /// - Imm(8) - The immediate (interpreted as a double) to add
+ /// - Imm(8) - Bit pattern of the floating-point immediate
GIR_AddCFPImm,
/// Render complex operands to the specified instruction
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
index d356f82ae6960..38a4031afdfed 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
@@ -1342,11 +1342,9 @@ bool GIMatchTableExecutor::executeMatchTable(
assert(OutMIs[InsnID] && "Attempted to add to undefined instruction");
LLT Ty = ExecInfo.TypeObjects[TypeID];
+ unsigned Width = Ty.getScalarSizeInBits();
LLVMContext &Ctx = MF->getFunction().getContext();
- APFloat APF(static_cast<double>(static_cast<int64_t>(Imm)));
- bool Ignored;
- APF.convert(getFltSemanticForLLT(Ty.getScalarType()),
- APFloat::rmNearestTiesToEven, &Ignored);
+ APFloat APF(getFltSemanticForLLT(Ty.getScalarType()), APInt(Width, Imm));
OutMIs[InsnID].addFPImm(ConstantFP::get(Ctx, APF));
DEBUG_WITH_TYPE(TgtExecutor::getName(),
dbgs() << CurrentIdx << ": GIR_AddCFPImm(OutMIs["
diff --git a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
index 33f13625ec36b..b2324e7654a69 100644
--- a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
+++ b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
@@ -26,88 +26,163 @@ def CImmInstTest1 : GICombineRule<
(match (G_CONSTANT $a, (i32 0))),
(apply (G_CONSTANT $a, (i32 42)))>;
-// emits a CFPImm because G_FCONSTANT is a special case, like G_CONSTANT. The
-// literal is interpreted as a floating-point value (the pattern grammar has
-// no fp literals), so 42 means 42.0 here.
-def FPImmInstTest1 : GICombineRule<
+// G_FCONSTANT apply with a concrete f32 IEEE bit pattern. The pattern grammar
+// has no fp literals, so 0x3f800000 is 1.0f (not the integer 1).
+def FPImmF32 : GICombineRule<
(defs root:$a),
(match (G_FCONSTANT $a, (f32 0))),
- (apply (G_FCONSTANT $a, (f32 42)))>;
+ (apply (G_FCONSTANT $a, (f32 0x3f800000)))>;
+
+// Same for f64: 0x3ff0000000000000 is 1.0.
+def FPImmF64 : GICombineRule<
+ (defs root:$a),
+ (match (G_FCONSTANT $a, (f64 0))),
+ (apply (G_FCONSTANT $a, (f64 0x3ff0000000000000)))>;
+
+// GITypeOf +0.0. Bit pattern 0 is +0.0 for every FP width, so this is the
+// portable "replace with a typed zero" form used with nested matches.
+def FPImmTypeOfZero : GICombineRule<
+ (defs root:$dst),
+ (match (G_FNEG $t, $src),
+ (G_FNEG $dst, $t)),
+ (apply (G_FCONSTANT $dst, (GITypeOf<"$dst"> 0)))>;
+
+// GITypeOf with a non-zero pattern that has both an integer and a fractional
+// part as f32 (0x3fc00000 == 1.5f). The bits are applied using $a's matched type.
+def FPImmTypeOfFrac : GICombineRule<
+ (defs root:$a),
+ (match (G_FABS $a, $src)),
+ (apply (G_FCONSTANT $a, (GITypeOf<"$a"> 0x3fc00000)))>;
def MyCombiner: GICombiner<"GenMyCombiner", [
InstTest0,
InstTest1,
CImmInstTest1,
- FPImmInstTest1
+ FPImmF32,
+ FPImmF64,
+ FPImmTypeOfZero,
+ FPImmTypeOfFrac
]>;
// CHECK: const uint8_t *GenMyCombiner::getMatchTable() const {
// CHECK-NEXT: constexpr static uint8_t MatchTable0[] = {
-// CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 4*/ GIMT_Encode4([[L690:[0-9]+]]),
-// CHECK-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4([[L550:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4([[L575:[0-9]+]]),
-// CHECK-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4([[L615:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4([[L655:[0-9]+]]),
-// CHECK-NEXT: // Label 0: @[[L550]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 5*/ GIMT_Encode4([[L574:[0-9]+]]), // Rule ID 0 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
-// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
-// CHECK-NEXT: // Combiner Rule #0: InstTest0
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 5: @[[L574]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 1: @[[L575]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 6*/ GIMT_Encode4([[L614:[0-9]+]]), // Rule ID 2 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
-// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
-// CHECK-NEXT: // Combiner Rule #2: CImmInstTest1
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_CONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 6: @[[L614]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 2: @[[L615]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4([[L654:[0-9]+]]), // Rule ID 3 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
-// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
-// CHECK-NEXT: // Combiner Rule #3: FPImmInstTest1
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 7: @[[L654]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 3: @[[L655]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4([[L689:[0-9]+]]), // Rule ID 1 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: // MIs[0] Operand 1
-// CHECK-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
-// CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
-// CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
-// CHECK-NEXT: // Combiner Rule #1: InstTest1
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 8: @[[L689]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 4: @[[L690]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: }; // Size: {{[0-9]+}} bytes
+// CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 6*/ GIMT_Encode4({{[0-9]+}}),
+// CHECK-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4(814), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4(839),
+// CHECK-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4(879), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4(973), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_FNEG*//*Label 4*/ GIMT_Encode4(1008), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_FABS*//*Label 5*/ GIMT_Encode4(1048),
+// CHECK-NEXT: // Label 0: @814
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4(838), // Rule ID 0 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
+// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
+// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
+// CHECK-NEXT: // Combiner Rule #0: InstTest0
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 7: @838
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 1: @839
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4(878), // Rule ID 2 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
+// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
+// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// CHECK-NEXT: // Combiner Rule #2: CImmInstTest1
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_CONSTANT),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// CHECK-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 8: @878
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 2: @879
+// CHECK-NEXT: GIM_SwitchType, /*MI*/0, /*Op*/1, /*[*/GIMT_Encode2(0), GIMT_Encode2(2), /*)*//*default:*//*Label 11*/ GIMT_Encode4(972),
+// CHECK-NEXT: /*GILLT_s32*//*Label 9*/ GIMT_Encode4(898),
+// CHECK-NEXT: /*GILLT_s64*//*Label 10*/ GIMT_Encode4(935),
+// CHECK-NEXT: // Label 9: @898
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 12*/ GIMT_Encode4(934), // Rule ID 3 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
+// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// CHECK-NEXT: // Combiner Rule #3: FPImmF32
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(1065353216),
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 12: @934
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 10: @935
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 13*/ GIMT_Encode4(971), // Rule ID 4 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled),
+// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// CHECK-NEXT: // Combiner Rule #4: FPImmF64
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s64, /*Imm*/GIMT_Encode8(4607182418800017408),
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 13: @971
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 11: @972
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 3: @973
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 14*/ GIMT_Encode4(1007), // Rule ID 1 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
+// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: // MIs[0] Operand 1
+// CHECK-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
+// CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
+// CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
+// CHECK-NEXT: // Combiner Rule #1: InstTest1
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 14: @1007
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 4: @1008
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 15*/ GIMT_Encode4(1047), // Rule ID 5 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
+// CHECK-NEXT: // MIs[0] dst
+// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
+// CHECK-NEXT: // MIs[0] t
+// CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
+// CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FNEG),
+// CHECK-NEXT: // MIs[1] src
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: GIM_CheckIsSafeToFold, /*NumInsns*/1,
+// CHECK-NEXT: // Combiner Rule #5: FPImmTypeOfZero
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // dst
+// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(0),
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 15: @1047
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 5: @1048
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4(1077), // Rule ID 6 //
+// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled),
+// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
+// CHECK-NEXT: // MIs[0] src
+// CHECK-NEXT: // No operand predicates
+// CHECK-NEXT: // Combiner Rule #6: FPImmTypeOfFrac
+// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(1069547520),
+// CHECK-NEXT: GIR_EraseRootFromParent_Done,
+// CHECK-NEXT: // Label 16: @1077
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: // Label 6: @1078
+// CHECK-NEXT: GIM_Reject,
+// CHECK-NEXT: }; // Size: {{[0-9]+}} bytes
// CHECK-NEXT: return MatchTable0;
// CHECK-NEXT: }
diff --git a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td
deleted file mode 100644
index 56da3de3acc74..0000000000000
--- a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof-fconstant.td
+++ /dev/null
@@ -1,46 +0,0 @@
-// RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
-// RUN: -combiners=MyCombiner %s | \
-// RUN: FileCheck %s
-
-include "llvm/Target/Target.td"
-include "llvm/Target/GlobalISel/Combine.td"
-
-def MyTargetISA : InstrInfo;
-def MyTarget : Target { let InstructionSet = MyTargetISA; }
-
-// G_FCONSTANT, like G_CONSTANT, can be built directly in an apply pattern
-// with a GITypeOf-typed literal. The literal is interpreted as a
-// floating-point value (the pattern grammar has no fp literals).
-def Test0 : GICombineRule<
- (defs root:$dst),
- (match (G_FNEG $t, $src),
- (G_FNEG $dst, $t)),
- (apply (G_FCONSTANT $dst, (GITypeOf<"$dst"> 0)))>;
-
-// CHECK: const uint8_t *GenMyCombiner::getMatchTable() const {
-// CHECK-NEXT: constexpr static uint8_t MatchTable0[] = {
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 0*/ GIMT_Encode4([[L34:[0-9]+]]), // Rule ID 0 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
-// CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FNEG),
-// CHECK-NEXT: // MIs[0] dst
-// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
-// CHECK-NEXT: // MIs[0] t
-// CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
-// CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FNEG),
-// CHECK-NEXT: // MIs[1] src
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckIsSafeToFold, /*NumInsns*/1,
-// CHECK-NEXT: // Combiner Rule #0: Test0
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // dst
-// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(0),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 0: @[[L34]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: }; // Size: {{[0-9]+}} bytes
-// CHECK-NEXT: return MatchTable0;
-// CHECK-NEXT: }
-
-def MyCombiner: GICombiner<"GenMyCombiner", [
- Test0
-]>;
diff --git a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
index 63c3b09272fbe..9f3608e1e7f00 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
+++ b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
@@ -2033,8 +2033,8 @@ class TempRegRenderer : public OperandRenderer {
/// Adds a specific immediate to the instruction being built.
/// If a LLT is passed, a ConstantInt immediate is created instead, unless
-/// IsFP is set, in which case the immediate is interpreted as a
-/// floating-point value (a double) and a ConstantFP immediate is created.
+/// IsFP is set, in which case Imm is treated as an IEEE bit pattern and a
+/// ConstantFP immediate is created.
class ImmRenderer : public OperandRenderer {
protected:
unsigned InsnID;
diff --git a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
index 5b05ba24d77f8..68088eb3633d8 100644
--- a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
@@ -2130,9 +2130,9 @@ bool CombineRuleBuilder::emitCodeGenInstructionApplyImmOperand(
RuleMatcher &M, BuildMIAction &DstMI, const CodeGenInstructionPattern &P,
const InstructionOperand &O) {
// If we have a type, we implicitly emit a G_CONSTANT, except for G_CONSTANT
- // itself (which needs a CImm) and G_FCONSTANT (which needs an FP immediate,
- // the literal being interpreted as a floating-point value since the
- // pattern grammar has no fp literals).
+ // itself (which needs a CImm) and G_FCONSTANT (which needs an FP immediate).
+ // The pattern grammar has no fp literals, so a G_FCONSTANT immediate is an
+ // IEEE bit pattern of the immediate's type (0 is +0.0 for every FP width).
//
// No type means we emit a simple imm.
// G_CONSTANT/G_FCONSTANT are special cases and need a typed immediate
>From d63d93d520f06be22195c7f96a9d2ec7e3fc3f13 Mon Sep 17 00:00:00 2001
From: vg0204 <Vikash.Gupta at amd.com>
Date: Fri, 18 Sep 2026 14:28:47 +0530
Subject: [PATCH 4/5] [GlobalISel] Decode GITypeOf recorded types in
GIR_AddCImm/GIR_AddCFPImm
Use getTypeFromIdx for typed immediates, constrain the 1.5f GITypeOf case to f32, and rename CImmLLT to ConstantLLT.
---
.../GlobalISel/GIMatchTableExecutorImpl.h | 4 +-
.../match-table-imms.td | 76 +++++++++----------
.../Common/GlobalISel/MatchTable/Matchers.cpp | 6 +-
.../Common/GlobalISel/MatchTable/Matchers.h | 20 ++---
4 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
index 38a4031afdfed..47af2934669a3 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
@@ -1324,7 +1324,7 @@ bool GIMatchTableExecutor::executeMatchTable(
uint64_t Imm = readU64();
assert(OutMIs[InsnID] && "Attempted to add to undefined instruction");
- unsigned Width = ExecInfo.TypeObjects[TypeID].getScalarSizeInBits();
+ unsigned Width = getTypeFromIdx(TypeID).getScalarSizeInBits();
LLVMContext &Ctx = MF->getFunction().getContext();
OutMIs[InsnID].addCImm(
ConstantInt::get(IntegerType::get(Ctx, Width), Imm, /*signed*/ true));
@@ -1341,7 +1341,7 @@ bool GIMatchTableExecutor::executeMatchTable(
uint64_t Imm = readU64();
assert(OutMIs[InsnID] && "Attempted to add to undefined instruction");
- LLT Ty = ExecInfo.TypeObjects[TypeID];
+ LLT Ty = getTypeFromIdx(TypeID);
unsigned Width = Ty.getScalarSizeInBits();
LLVMContext &Ctx = MF->getFunction().getContext();
APFloat APF(getFltSemanticForLLT(Ty.getScalarType()), APInt(Width, Imm));
diff --git a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
index b2324e7654a69..bde646a7a9965 100644
--- a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
+++ b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
@@ -44,14 +44,14 @@ def FPImmF64 : GICombineRule<
def FPImmTypeOfZero : GICombineRule<
(defs root:$dst),
(match (G_FNEG $t, $src),
- (G_FNEG $dst, $t)),
+ (G_FNEG f32:$dst, $t)),
(apply (G_FCONSTANT $dst, (GITypeOf<"$dst"> 0)))>;
// GITypeOf with a non-zero pattern that has both an integer and a fractional
// part as f32 (0x3fc00000 == 1.5f). The bits are applied using $a's matched type.
def FPImmTypeOfFrac : GICombineRule<
(defs root:$a),
- (match (G_FABS $a, $src)),
+ (match (G_FABS f32:$a, $src)),
(apply (G_FCONSTANT $a, (GITypeOf<"$a"> 0x3fc00000)))>;
def MyCombiner: GICombiner<"GenMyCombiner", [
@@ -66,15 +66,15 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK: const uint8_t *GenMyCombiner::getMatchTable() const {
// CHECK-NEXT: constexpr static uint8_t MatchTable0[] = {
-// CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 6*/ GIMT_Encode4({{[0-9]+}}),
-// CHECK-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4(814), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4(839),
-// CHECK-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4(879), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4(973), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_FNEG*//*Label 4*/ GIMT_Encode4(1008), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_FABS*//*Label 5*/ GIMT_Encode4(1048),
-// CHECK-NEXT: // Label 0: @814
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4(838), // Rule ID 0 //
+// CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 6*/ GIMT_Encode4([[LBL6:[0-9]+]]),
+// CHECK-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4([[LBL0:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4([[LBL1:[0-9]+]]),
+// CHECK-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4([[LBL2:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4([[LBL3:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_FNEG*//*Label 4*/ GIMT_Encode4([[LBL4:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// CHECK-NEXT: /*TargetOpcode::G_FABS*//*Label 5*/ GIMT_Encode4([[LBL5:[0-9]+]]),
+// CHECK-NEXT: // Label 0: @[[LBL0]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4([[LBL7:[0-9]+]]), // Rule ID 0 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
// CHECK-NEXT: // MIs[0] a
@@ -85,10 +85,10 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 7: @838
+// CHECK-NEXT: // Label 7: @[[LBL7]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 1: @839
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4(878), // Rule ID 2 //
+// CHECK-NEXT: // Label 1: @[[LBL1]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4([[LBL8:[0-9]+]]), // Rule ID 2 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
// CHECK-NEXT: // MIs[0] a
@@ -99,14 +99,14 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 8: @878
+// CHECK-NEXT: // Label 8: @[[LBL8]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 2: @879
-// CHECK-NEXT: GIM_SwitchType, /*MI*/0, /*Op*/1, /*[*/GIMT_Encode2(0), GIMT_Encode2(2), /*)*//*default:*//*Label 11*/ GIMT_Encode4(972),
-// CHECK-NEXT: /*GILLT_s32*//*Label 9*/ GIMT_Encode4(898),
-// CHECK-NEXT: /*GILLT_s64*//*Label 10*/ GIMT_Encode4(935),
-// CHECK-NEXT: // Label 9: @898
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 12*/ GIMT_Encode4(934), // Rule ID 3 //
+// CHECK-NEXT: // Label 2: @[[LBL2]]
+// CHECK-NEXT: GIM_SwitchType, /*MI*/0, /*Op*/1, /*[*/GIMT_Encode2(0), GIMT_Encode2(2), /*)*//*default:*//*Label 11*/ GIMT_Encode4([[LBL11:[0-9]+]]),
+// CHECK-NEXT: /*GILLT_s32*//*Label 9*/ GIMT_Encode4([[LBL9:[0-9]+]]),
+// CHECK-NEXT: /*GILLT_s64*//*Label 10*/ GIMT_Encode4([[LBL10:[0-9]+]]),
+// CHECK-NEXT: // Label 9: @[[LBL9]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 12*/ GIMT_Encode4([[LBL12:[0-9]+]]), // Rule ID 3 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
// CHECK-NEXT: // MIs[0] a
// CHECK-NEXT: // No operand predicates
@@ -116,10 +116,10 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(1065353216),
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 12: @934
+// CHECK-NEXT: // Label 12: @[[LBL12]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 10: @935
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 13*/ GIMT_Encode4(971), // Rule ID 4 //
+// CHECK-NEXT: // Label 10: @[[LBL10]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 13*/ GIMT_Encode4([[LBL13:[0-9]+]]), // Rule ID 4 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled),
// CHECK-NEXT: // MIs[0] a
// CHECK-NEXT: // No operand predicates
@@ -129,12 +129,12 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s64, /*Imm*/GIMT_Encode8(4607182418800017408),
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 13: @971
+// CHECK-NEXT: // Label 13: @[[LBL13]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 11: @972
+// CHECK-NEXT: // Label 11: @[[LBL11]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 3: @973
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 14*/ GIMT_Encode4(1007), // Rule ID 1 //
+// CHECK-NEXT: // Label 3: @[[LBL3]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 14*/ GIMT_Encode4([[LBL14:[0-9]+]]), // Rule ID 1 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
// CHECK-NEXT: // MIs[0] a
// CHECK-NEXT: // No operand predicates
@@ -147,12 +147,12 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 14: @1007
+// CHECK-NEXT: // Label 14: @[[LBL14]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 4: @1008
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 15*/ GIMT_Encode4(1047), // Rule ID 5 //
+// CHECK-NEXT: // Label 4: @[[LBL4]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 15*/ GIMT_Encode4([[LBL15:[0-9]+]]), // Rule ID 5 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
-// CHECK-NEXT: // MIs[0] dst
+// CHECK-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
// CHECK-NEXT: // MIs[0] t
// CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
@@ -165,12 +165,12 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(0),
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 15: @1047
+// CHECK-NEXT: // Label 15: @[[LBL15]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 5: @1048
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4(1077), // Rule ID 6 //
+// CHECK-NEXT: // Label 5: @[[LBL5]]
+// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4([[LBL16:[0-9]+]]), // Rule ID 6 //
// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled),
-// CHECK-NEXT: // MIs[0] a
+// CHECK-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
// CHECK-NEXT: // MIs[0] src
// CHECK-NEXT: // No operand predicates
@@ -179,9 +179,9 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(1069547520),
// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 16: @1077
+// CHECK-NEXT: // Label 16: @[[LBL16]]
// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 6: @1078
+// CHECK-NEXT: // Label 6: @[[LBL6]]
// CHECK-NEXT: GIM_Reject,
// CHECK-NEXT: }; // Size: {{[0-9]+}} bytes
// CHECK-NEXT: return MatchTable0;
diff --git a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
index 656ab5379fc11..72a879658d6c3 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
+++ b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.cpp
@@ -1843,13 +1843,13 @@ void ImmRenderer::emitAddImm(MatchTable &Table, unsigned InsnID, int64_t Imm,
}
void ImmRenderer::emitRenderOpcodes(MatchTable &Table) const {
- if (CImmLLT) {
+ if (ConstantLLT) {
assert(Table.isCombiner() &&
- "ConstantInt immediate are only for combiners!");
+ "ConstantInt/ConstantFP immediates are only for combiners!");
Table << MatchTable::Opcode(IsFP ? "GIR_AddCFPImm" : "GIR_AddCImm")
<< MatchTable::Comment("InsnID") << MatchTable::ULEB128Value(InsnID)
<< MatchTable::Comment("Type");
- emitType(Table, *CImmLLT);
+ emitType(Table, *ConstantLLT);
Table << MatchTable::Comment("Imm") << MatchTable::IntValue(8, Imm)
<< MatchTable::LineBreak;
} else {
diff --git a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
index 9f3608e1e7f00..83a8b87ca3d61 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
+++ b/llvm/utils/TableGen/Common/GlobalISel/MatchTable/Matchers.h
@@ -2032,26 +2032,26 @@ class TempRegRenderer : public OperandRenderer {
};
/// Adds a specific immediate to the instruction being built.
-/// If a LLT is passed, a ConstantInt immediate is created instead, unless
-/// IsFP is set, in which case Imm is treated as an IEEE bit pattern and a
-/// ConstantFP immediate is created.
+/// Without a type this is a raw integer immediate. With ConstantLLT it is a
+/// typed constant: ConstantInt, or ConstantFP when IsFP is set (Imm is then
+/// the IEEE bit pattern of that type).
class ImmRenderer : public OperandRenderer {
protected:
unsigned InsnID;
int64_t Imm;
- std::optional<LLTCodeGenOrTempType> CImmLLT;
+ std::optional<LLTCodeGenOrTempType> ConstantLLT;
bool IsFP = false;
public:
ImmRenderer(unsigned InsnID, int64_t Imm)
: OperandRenderer(OR_Imm), InsnID(InsnID), Imm(Imm) {}
- ImmRenderer(unsigned InsnID, int64_t Imm, const LLTCodeGenOrTempType &CImmLLT,
- bool IsFP = false)
- : OperandRenderer(OR_Imm), InsnID(InsnID), Imm(Imm), CImmLLT(CImmLLT),
- IsFP(IsFP) {
- if (CImmLLT.isLLTCodeGen())
- KnownTypes.insert(CImmLLT.getLLTCodeGen());
+ ImmRenderer(unsigned InsnID, int64_t Imm,
+ const LLTCodeGenOrTempType &ConstantLLT, bool IsFP = false)
+ : OperandRenderer(OR_Imm), InsnID(InsnID), Imm(Imm),
+ ConstantLLT(ConstantLLT), IsFP(IsFP) {
+ if (ConstantLLT.isLLTCodeGen())
+ KnownTypes.insert(ConstantLLT.getLLTCodeGen());
}
static bool classof(const OperandRenderer *R) {
>From c28a83324a3d24653158c5a5956d60b6626a228d Mon Sep 17 00:00:00 2001
From: vg0204 <Vikash.Gupta at amd.com>
Date: Mon, 21 Sep 2026 14:32:14 +0530
Subject: [PATCH 5/5] Added fp16/bf16 match table emission tests for default &
extended-LLT modes.
---
.../match-table-imms.td | 455 +++++++++++++-----
1 file changed, 332 insertions(+), 123 deletions(-)
diff --git a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
index bde646a7a9965..e20c0440726dd 100644
--- a/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
+++ b/llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
@@ -1,6 +1,9 @@
// RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
// RUN: -combiners=MyCombiner %s | \
-// RUN: FileCheck %s
+// RUN: FileCheck --check-prefix=DEFAULT %s
+// RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
+// RUN: -combiners=MyCombiner -gisel-extended-llt %s | \
+// RUN: FileCheck --check-prefix=EXTLLT %s
include "llvm/Target/Target.td"
include "llvm/Target/GlobalISel/Combine.td"
@@ -39,6 +42,18 @@ def FPImmF64 : GICombineRule<
(match (G_FCONSTANT $a, (f64 0))),
(apply (G_FCONSTANT $a, (f64 0x3ff0000000000000)))>;
+// fp16 and bf16 share a bit width but differ in exponent/mantissa split:
+// 0x3c00 is 1.0 as f16, 0x3f80 is 1.0 as bf16.
+def FPImmF16 : GICombineRule<
+ (defs root:$a),
+ (match (G_FCONSTANT $a, (f16 0))),
+ (apply (G_FCONSTANT $a, (f16 0x3c00)))>;
+
+def FPImmBF16 : GICombineRule<
+ (defs root:$a),
+ (match (G_FCONSTANT $a, (bf16 0))),
+ (apply (G_FCONSTANT $a, (bf16 0x3f80)))>;
+
// GITypeOf +0.0. Bit pattern 0 is +0.0 for every FP width, so this is the
// portable "replace with a typed zero" form used with nested matches.
def FPImmTypeOfZero : GICombineRule<
@@ -60,129 +75,323 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
CImmInstTest1,
FPImmF32,
FPImmF64,
+ FPImmF16,
+ FPImmBF16,
FPImmTypeOfZero,
FPImmTypeOfFrac
]>;
-// CHECK: const uint8_t *GenMyCombiner::getMatchTable() const {
-// CHECK-NEXT: constexpr static uint8_t MatchTable0[] = {
-// CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 6*/ GIMT_Encode4([[LBL6:[0-9]+]]),
-// CHECK-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4([[LBL0:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4([[LBL1:[0-9]+]]),
-// CHECK-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4([[LBL2:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4([[LBL3:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_FNEG*//*Label 4*/ GIMT_Encode4([[LBL4:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
-// CHECK-NEXT: /*TargetOpcode::G_FABS*//*Label 5*/ GIMT_Encode4([[LBL5:[0-9]+]]),
-// CHECK-NEXT: // Label 0: @[[LBL0]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4([[LBL7:[0-9]+]]), // Rule ID 0 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
-// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
-// CHECK-NEXT: // Combiner Rule #0: InstTest0
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 7: @[[LBL7]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 1: @[[LBL1]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4([[LBL8:[0-9]+]]), // Rule ID 2 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
-// CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
-// CHECK-NEXT: // Combiner Rule #2: CImmInstTest1
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_CONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 8: @[[LBL8]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 2: @[[LBL2]]
-// CHECK-NEXT: GIM_SwitchType, /*MI*/0, /*Op*/1, /*[*/GIMT_Encode2(0), GIMT_Encode2(2), /*)*//*default:*//*Label 11*/ GIMT_Encode4([[LBL11:[0-9]+]]),
-// CHECK-NEXT: /*GILLT_s32*//*Label 9*/ GIMT_Encode4([[LBL9:[0-9]+]]),
-// CHECK-NEXT: /*GILLT_s64*//*Label 10*/ GIMT_Encode4([[LBL10:[0-9]+]]),
-// CHECK-NEXT: // Label 9: @[[LBL9]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 12*/ GIMT_Encode4([[LBL12:[0-9]+]]), // Rule ID 3 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
-// CHECK-NEXT: // Combiner Rule #3: FPImmF32
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(1065353216),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 12: @[[LBL12]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 10: @[[LBL10]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 13*/ GIMT_Encode4([[LBL13:[0-9]+]]), // Rule ID 4 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled),
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
-// CHECK-NEXT: // Combiner Rule #4: FPImmF64
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s64, /*Imm*/GIMT_Encode8(4607182418800017408),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 13: @[[LBL13]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 11: @[[LBL11]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 3: @[[LBL3]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 14*/ GIMT_Encode4([[LBL14:[0-9]+]]), // Rule ID 1 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
-// CHECK-NEXT: // MIs[0] a
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: // MIs[0] Operand 1
-// CHECK-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
-// CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
-// CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
-// CHECK-NEXT: // Combiner Rule #1: InstTest1
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 14: @[[LBL14]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 4: @[[LBL4]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 15*/ GIMT_Encode4([[LBL15:[0-9]+]]), // Rule ID 5 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
-// CHECK-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
-// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
-// CHECK-NEXT: // MIs[0] t
-// CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
-// CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FNEG),
-// CHECK-NEXT: // MIs[1] src
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: GIM_CheckIsSafeToFold, /*NumInsns*/1,
-// CHECK-NEXT: // Combiner Rule #5: FPImmTypeOfZero
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // dst
-// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(0),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 15: @[[LBL15]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 5: @[[LBL5]]
-// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4([[LBL16:[0-9]+]]), // Rule ID 6 //
-// CHECK-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled),
-// CHECK-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
-// CHECK-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
-// CHECK-NEXT: // MIs[0] src
-// CHECK-NEXT: // No operand predicates
-// CHECK-NEXT: // Combiner Rule #6: FPImmTypeOfFrac
-// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
-// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
-// CHECK-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(1069547520),
-// CHECK-NEXT: GIR_EraseRootFromParent_Done,
-// CHECK-NEXT: // Label 16: @[[LBL16]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: // Label 6: @[[LBL6]]
-// CHECK-NEXT: GIM_Reject,
-// CHECK-NEXT: }; // Size: {{[0-9]+}} bytes
-// CHECK-NEXT: return MatchTable0;
-// CHECK-NEXT: }
+// Default (no -gisel-extended-llt): f16 and bf16 both collapse to the
+// generic scalar GILLT_s16 and share one GIM_SwitchType case.
+// GIR_AddCFPImm tags both with GILLT_s16, so getFltSemanticForLLT() cannot
+// tell them apart and assumes IEEEhalf.
+// DEFAULT: const uint8_t *GenMyCombiner::getMatchTable() const {
+// DEFAULT-NEXT: constexpr static uint8_t MatchTable0[] = {
+// DEFAULT-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 6*/ GIMT_Encode4([[LBL6:[0-9]+]]),
+// DEFAULT-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4([[LBL0:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// DEFAULT-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4([[LBL1:[0-9]+]]),
+// DEFAULT-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4([[LBL2:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// DEFAULT-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4([[LBL3:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// DEFAULT-NEXT: /*TargetOpcode::G_FNEG*//*Label 4*/ GIMT_Encode4([[LBL4:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// DEFAULT-NEXT: /*TargetOpcode::G_FABS*//*Label 5*/ GIMT_Encode4([[LBL5:[0-9]+]]),
+// DEFAULT-NEXT: // Label 0: @[[LBL0]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4([[LBL7:[0-9]+]]), // Rule ID 0 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
+// DEFAULT-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
+// DEFAULT-NEXT: // MIs[0] a
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
+// DEFAULT-NEXT: // Combiner Rule #0: InstTest0
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 7: @[[LBL7]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 1: @[[LBL1]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4([[LBL8:[0-9]+]]), // Rule ID 2 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
+// DEFAULT-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
+// DEFAULT-NEXT: // MIs[0] a
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// DEFAULT-NEXT: // Combiner Rule #2: CImmInstTest1
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_CONSTANT),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(42),
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 8: @[[LBL8]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 2: @[[LBL2]]
+// DEFAULT-NEXT: GIM_SwitchType, /*MI*/0, /*Op*/1, /*[*/GIMT_Encode2(0), GIMT_Encode2(3), /*)*//*default:*//*Label 12*/ GIMT_Encode4([[LBL12:[0-9]+]]),
+// DEFAULT-NEXT: /*GILLT_s16*//*Label 9*/ GIMT_Encode4([[LBL9:[0-9]+]]),
+// DEFAULT-NEXT: /*GILLT_s32*//*Label 10*/ GIMT_Encode4([[LBL10:[0-9]+]]),
+// DEFAULT-NEXT: /*GILLT_s64*//*Label 11*/ GIMT_Encode4([[LBL11:[0-9]+]]),
+// DEFAULT-NEXT: // Label 9: @[[LBL9]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 13*/ GIMT_Encode4([[LBL13:[0-9]+]]),
+// DEFAULT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 14*/ GIMT_Encode4([[LBL14:[0-9]+]]), // Rule ID 5 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
+// DEFAULT-NEXT: // MIs[0] a
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: // Combiner Rule #5: FPImmF16
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s16, /*Imm*/GIMT_Encode8(15360),
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 14: @[[LBL14]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 15*/ GIMT_Encode4([[LBL15:[0-9]+]]), // Rule ID 6 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled),
+// DEFAULT-NEXT: // MIs[0] a
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: // Combiner Rule #6: FPImmBF16
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s16, /*Imm*/GIMT_Encode8(16256),
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 15: @[[LBL15]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 13: @[[LBL13]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 10: @[[LBL10]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4([[LBL16:[0-9]+]]), // Rule ID 3 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
+// DEFAULT-NEXT: // MIs[0] a
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// DEFAULT-NEXT: // Combiner Rule #3: FPImmF32
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s32, /*Imm*/GIMT_Encode8(1065353216),
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 16: @[[LBL16]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 11: @[[LBL11]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 17*/ GIMT_Encode4([[LBL17:[0-9]+]]), // Rule ID 4 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled),
+// DEFAULT-NEXT: // MIs[0] a
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// DEFAULT-NEXT: // Combiner Rule #4: FPImmF64
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_s64, /*Imm*/GIMT_Encode8(4607182418800017408),
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 17: @[[LBL17]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 12: @[[LBL12]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 3: @[[LBL3]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 18*/ GIMT_Encode4([[LBL18:[0-9]+]]), // Rule ID 1 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
+// DEFAULT-NEXT: // MIs[0] a
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: // MIs[0] Operand 1
+// DEFAULT-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
+// DEFAULT-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
+// DEFAULT-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
+// DEFAULT-NEXT: // Combiner Rule #1: InstTest1
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 18: @[[LBL18]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 4: @[[LBL4]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 19*/ GIMT_Encode4([[LBL19:[0-9]+]]), // Rule ID 7 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule7Enabled),
+// DEFAULT-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
+// DEFAULT-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
+// DEFAULT-NEXT: // MIs[0] t
+// DEFAULT-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
+// DEFAULT-NEXT: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FNEG),
+// DEFAULT-NEXT: // MIs[1] src
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: GIM_CheckIsSafeToFold, /*NumInsns*/1,
+// DEFAULT-NEXT: // Combiner Rule #7: FPImmTypeOfZero
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // dst
+// DEFAULT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(0),
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 19: @[[LBL19]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 5: @[[LBL5]]
+// DEFAULT-NEXT: GIM_Try, /*On fail goto*//*Label 20*/ GIMT_Encode4([[LBL20:[0-9]+]]), // Rule ID 8 //
+// DEFAULT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule8Enabled),
+// DEFAULT-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
+// DEFAULT-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
+// DEFAULT-NEXT: // MIs[0] src
+// DEFAULT-NEXT: // No operand predicates
+// DEFAULT-NEXT: // Combiner Rule #8: FPImmTypeOfFrac
+// DEFAULT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// DEFAULT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// DEFAULT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(1069547520),
+// DEFAULT-NEXT: GIR_EraseRootFromParent_Done,
+// DEFAULT-NEXT: // Label 20: @[[LBL20]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: // Label 6: @[[LBL6]]
+// DEFAULT-NEXT: GIM_Reject,
+// DEFAULT-NEXT: }; // Size: {{[0-9]+}} bytes
+// DEFAULT-NEXT: return MatchTable0;
+// DEFAULT-NEXT: }
+
+// With -gisel-extended-llt (used by AMDGPU's combiner tables): f16 and
+// bf16 get distinct GILLT_f16/GILLT_bf16 entries tagged with their real
+// FpSemantics, so GIR_AddCFPImm's type disambiguates them correctly.
+// EXTLLT: enum {
+// EXTLLT-NEXT: GILLT_i32,
+// EXTLLT-NEXT: GILLT_f16,
+// EXTLLT-NEXT: GILLT_bf16,
+// EXTLLT-NEXT: GILLT_f32,
+// EXTLLT-NEXT: GILLT_f64,
+// EXTLLT-NEXT: };
+// EXTLLT: const uint8_t *GenMyCombiner::getMatchTable() const {
+// EXTLLT-NEXT: constexpr static uint8_t MatchTable0[] = {
+// EXTLLT-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 6*/ GIMT_Encode4([[LBL6:[0-9]+]]),
+// EXTLLT-NEXT: /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4([[LBL0:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// EXTLLT-NEXT: /*TargetOpcode::G_CONSTANT*//*Label 1*/ GIMT_Encode4([[LBL1:[0-9]+]]),
+// EXTLLT-NEXT: /*TargetOpcode::G_FCONSTANT*//*Label 2*/ GIMT_Encode4([[LBL2:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// EXTLLT-NEXT: /*TargetOpcode::G_ZEXT*//*Label 3*/ GIMT_Encode4([[LBL3:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// EXTLLT-NEXT: /*TargetOpcode::G_FNEG*//*Label 4*/ GIMT_Encode4([[LBL4:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
+// EXTLLT-NEXT: /*TargetOpcode::G_FABS*//*Label 5*/ GIMT_Encode4([[LBL5:[0-9]+]]),
+// EXTLLT-NEXT: // Label 0: @[[LBL0]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4([[LBL7:[0-9]+]]), // Rule ID 0 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
+// EXTLLT-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_i32,
+// EXTLLT-NEXT: // MIs[0] a
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
+// EXTLLT-NEXT: // Combiner Rule #0: InstTest0
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 7: @[[LBL7]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 1: @[[LBL1]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4([[LBL8:[0-9]+]]), // Rule ID 2 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
+// EXTLLT-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_i32,
+// EXTLLT-NEXT: // MIs[0] a
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// EXTLLT-NEXT: // Combiner Rule #2: CImmInstTest1
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_CONSTANT),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/GILLT_i32, /*Imm*/GIMT_Encode8(42),
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 8: @[[LBL8]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 2: @[[LBL2]]
+// EXTLLT-NEXT: GIM_SwitchType, /*MI*/0, /*Op*/1, /*[*/GIMT_Encode2(1), GIMT_Encode2(5), /*)*//*default:*//*Label 13*/ GIMT_Encode4([[LBL13:[0-9]+]]),
+// EXTLLT-NEXT: /*GILLT_f16*//*Label 9*/ GIMT_Encode4([[LBL9:[0-9]+]]),
+// EXTLLT-NEXT: /*GILLT_bf16*//*Label 10*/ GIMT_Encode4([[LBL10:[0-9]+]]),
+// EXTLLT-NEXT: /*GILLT_f32*//*Label 11*/ GIMT_Encode4([[LBL11:[0-9]+]]),
+// EXTLLT-NEXT: /*GILLT_f64*//*Label 12*/ GIMT_Encode4([[LBL12:[0-9]+]]),
+// EXTLLT-NEXT: // Label 9: @[[LBL9]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 14*/ GIMT_Encode4([[LBL14:[0-9]+]]), // Rule ID 5 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
+// EXTLLT-NEXT: // MIs[0] a
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// EXTLLT-NEXT: // Combiner Rule #5: FPImmF16
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_f16, /*Imm*/GIMT_Encode8(15360),
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 14: @[[LBL14]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 10: @[[LBL10]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 15*/ GIMT_Encode4([[LBL15:[0-9]+]]), // Rule ID 6 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled),
+// EXTLLT-NEXT: // MIs[0] a
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// EXTLLT-NEXT: // Combiner Rule #6: FPImmBF16
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_bf16, /*Imm*/GIMT_Encode8(16256),
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 15: @[[LBL15]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 11: @[[LBL11]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4([[LBL16:[0-9]+]]), // Rule ID 3 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
+// EXTLLT-NEXT: // MIs[0] a
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// EXTLLT-NEXT: // Combiner Rule #3: FPImmF32
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_f32, /*Imm*/GIMT_Encode8(1065353216),
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 16: @[[LBL16]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 12: @[[LBL12]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 17*/ GIMT_Encode4([[LBL17:[0-9]+]]), // Rule ID 4 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled),
+// EXTLLT-NEXT: // MIs[0] a
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
+// EXTLLT-NEXT: // Combiner Rule #4: FPImmF64
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/GILLT_f64, /*Imm*/GIMT_Encode8(4607182418800017408),
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 17: @[[LBL17]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 13: @[[LBL13]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 3: @[[LBL3]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 18*/ GIMT_Encode4([[LBL18:[0-9]+]]), // Rule ID 1 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
+// EXTLLT-NEXT: // MIs[0] a
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: // MIs[0] Operand 1
+// EXTLLT-NEXT: GIM_CheckConstantInt8, /*MI*/0, /*Op*/1, 0,
+// EXTLLT-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_i32,
+// EXTLLT-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
+// EXTLLT-NEXT: // Combiner Rule #1: InstTest1
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 18: @[[LBL18]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 4: @[[LBL4]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 19*/ GIMT_Encode4([[LBL19:[0-9]+]]), // Rule ID 7 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule7Enabled),
+// EXTLLT-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_f32,
+// EXTLLT-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
+// EXTLLT-NEXT: // MIs[0] t
+// EXTLLT-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
+// EXTLLT-NEXT: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FNEG),
+// EXTLLT-NEXT: // MIs[1] src
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: GIM_CheckIsSafeToFold, /*NumInsns*/1,
+// EXTLLT-NEXT: // Combiner Rule #7: FPImmTypeOfZero
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // dst
+// EXTLLT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(0),
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 19: @[[LBL19]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 5: @[[LBL5]]
+// EXTLLT-NEXT: GIM_Try, /*On fail goto*//*Label 20*/ GIMT_Encode4([[LBL20:[0-9]+]]), // Rule ID 8 //
+// EXTLLT-NEXT: GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule8Enabled),
+// EXTLLT-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_f32,
+// EXTLLT-NEXT: GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/255,
+// EXTLLT-NEXT: // MIs[0] src
+// EXTLLT-NEXT: // No operand predicates
+// EXTLLT-NEXT: // Combiner Rule #8: FPImmTypeOfFrac
+// EXTLLT-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FCONSTANT),
+// EXTLLT-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // a
+// EXTLLT-NEXT: GIR_AddCFPImm, /*InsnID*/0, /*Type*/255, /*Imm*/GIMT_Encode8(1069547520),
+// EXTLLT-NEXT: GIR_EraseRootFromParent_Done,
+// EXTLLT-NEXT: // Label 20: @[[LBL20]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: // Label 6: @[[LBL6]]
+// EXTLLT-NEXT: GIM_Reject,
+// EXTLLT-NEXT: }; // Size: {{[0-9]+}} bytes
+// EXTLLT-NEXT: return MatchTable0;
+// EXTLLT-NEXT: }
More information about the llvm-commits
mailing list