[llvm-dev] [GlobalISel] Predicated TImmLeafs in patterns

Daniel Sanders via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 1 20:52:42 PST 2020


Hi Dominik,

Are you sure that Pat is being imported? TImmLeaf is a subclass of ImmLeaf/PatFrag/PatFrags so there needs to be an equivalent predicate check in the GISelPredicateCode field to be imported. IntImmLeaf/FPImmLeaf on the other hand can share the same code for DAGISel and GlobalISel because the difference between the two ISel's were abstracted out for those classes.

> On Nov 17, 2020, at 08:15, Dominik Montada via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
> I'm trying to use predicated TImmLeafs in TableGen patterns with GlobalISel to select intrinsics with immediate operands. While this is working so far, contrary to ImmLeafs the predicate does not seem to get checked. Is this not supported yet?
> 
> This is the pattern in question:
> 
> def tuimm9 : TImmLeaf<i32, [{ return isUInt<9>(Imm); }]>;
> def : Pat<(int_target_foo tuimm9:$mask), (FOO tuimm9:$mask)>;
> 
> Match table when using TImmLeaf:
> 
> GIM_CheckIsImm,
> 
> Match table when using ImmLeaf:
> 
> GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_CONSTANT,
> GIM_CheckI64ImmPredicate, /*MI*/1, /*Predicate*/GIPFP_I64_Predicate_uimm9,
> 
> Basically I'm wondering how I can make TableGen generate the GIM_CheckI64ImmPredicate when using TImmLeafs.
> 
> Cheers,
> 
> Dominik
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list