Skip to content

Commit 4a009fb

Browse files
committed
Add test for the optimized generation
1 parent 28edd62 commit 4a009fb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

llvm/test/TableGen/GlobalISelEmitter/predicated-pattern-order.td

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: llvm-tblgen -gen-global-isel -optimize-match-table=false -I %p/../../../include -I %p/../Common %s | FileCheck %s
2+
// RUN: llvm-tblgen -gen-global-isel -optimize-match-table=true -I %p/../../../include -I %p/../Common %s | FileCheck -check-prefix=OPT %s
23

34
include "llvm/Target/Target.td"
45
include "GlobalISelEmitterCommon.td"
@@ -45,6 +46,32 @@ def aligned_store: PatFrag<(ops node:$v, node:$a), (store $v, $a), [{
4546
// CHECK-NEXT: GIR_RootConstrainSelectedInstOperands,
4647
// CHECK-NEXT: // GIR_Coverage, 1,
4748

49+
// OPT: GIM_Try, /*On fail goto*//*Label 0*/ GIMT_Encode4(72),
50+
// OPT-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_STORE),
51+
// OPT-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
52+
// OPT-NEXT: GIM_CheckAtomicOrdering, /*MI*/0, /*Order*/(uint8_t)AtomicOrdering::NotAtomic,
53+
// OPT-NEXT: GIM_CheckMemorySizeEqualToLLT, /*MI*/0, /*MMO*/0, /*OpIdx*/0,
54+
55+
// OPT-NEXT: GIM_Try, /*On fail goto*//*Label 1*/ GIMT_Encode4(47), // Rule ID 0 //
56+
// OPT-NEXT: GIM_RootCheckRegBankForClass, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
57+
// OPT-NEXT: // MIs[0] src1
58+
// OPT-NEXT: GIM_CheckPointerToAny, /*MI*/0, /*Op*/1, /*SizeInBits*/32,
59+
// OPT-NEXT: GIM_RootCheckRegBankForClass, /*Op*/1, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
60+
// OPT-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GIMT_Encode2(GICXXPred_MI_Predicate_aligned_store),
61+
// OPT-NEXT: // (st GPR32:{ *:[i32] }:$src0, GPR32:{ *:[i32] }:$src1)<<P:Predicate_unindexedstore>><<P:Predicate_store>><<P:Predicate_aligned_store>> => (MOVALIGNED GPR32:{ *:[i32] }:$src0, GPR32:{ *:[i32] }:$src1)
62+
// OPT-NEXT: GIR_MutateOpcode, /*InsnID*/0, /*RecycleInsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOVALIGNED),
63+
// OPT-NEXT: GIR_RootConstrainSelectedInstOperands,
64+
// OPT-NEXT: // GIR_Coverage, 0,
65+
66+
// OPT: GIM_Try, /*On fail goto*//*Label 2*/ GIMT_Encode4(71), // Rule ID 1 //
67+
// OPT-NEXT: GIM_RootCheckRegBankForClass, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
68+
// OPT-NEXT: // MIs[0] src1
69+
// OPT-NEXT: GIM_CheckPointerToAny, /*MI*/0, /*Op*/1, /*SizeInBits*/32,
70+
// OPT-NEXT: GIM_RootCheckRegBankForClass, /*Op*/1, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
71+
// OPT-NEXT: // (st GPR32:{ *:[i32] }:$src0, GPR32:{ *:[i32] }:$src1)<<P:Predicate_unindexedstore>><<P:Predicate_store>> => (MOVUNALIGNED GPR32:{ *:[i32] }:$src0, GPR32:{ *:[i32] }:$src1)
72+
// OPT-NEXT: GIR_MutateOpcode, /*InsnID*/0, /*RecycleInsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOVUNALIGNED),
73+
// OPT-NEXT: GIR_RootConstrainSelectedInstOperands,
74+
// OPT-NEXT: // GIR_Coverage, 1,
4875

4976
def MOVALIGNED : I<(outs), (ins GPR32:$src0, GPR32:$src1),
5077
[(aligned_store GPR32:$src0, GPR32:$src1)]>;

0 commit comments

Comments
 (0)