search for: gicombinerule

Displaying 12 results from an estimated 12 matches for "gicombinerule".

2018 Nov 27
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...allows us to omit the defs for MI's involved in debug info. Any names used solely in the apply section and defined by a value-constructing operator (e.g. create*) can be omitted With these rules, the defs section isn't completely gone but is often empty and can be omitted with a variant of GICombineRule. The examples would be as below. I've indicated which rule eliminates which def with color coding and strike-through: // Omitted due to rule 1 // Omitted due to rule 2 // We haven't been listing any defs related to rule 3 since these are the formerly anonymous // operands th...
2018 Nov 30
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...I's involved in debug info. >> 6. Any names used solely in the apply section and defined by a >> value-constructing operator (e.g. create*) can be omitted >> With these rules, the defs section isn't completely gone but is often empty and can be omitted with a variant of GICombineRule. The examples would be as below. I've indicated which rule eliminates which def with color coding and strike-through: >> // Omitted due to rule 1 >> // Omitted due to rule 2 >> // We haven't been listing any defs related to rule 3 since these are the formerly a...
2018 Nov 27
3
[RFC] Tablegen-erated GlobalISel Combine Rules
...the examples to the DAG style we were talking about. Hopefully I haven't forgotten anything, there was a lot to keep track of :-). Overall, I think there's a couple places where things get a a little awkward (mainly debug info) but things generally look good to me. A Simple Example def : GICombineRule<(defs reg:$D, reg:$S), (match (G_ZEXT s32:$t1, s8:$S), (G_TRUNC s16:$D, s32:$t1)), (apply (G_ZEXT s16:$D, s8:$S))>; This has been converted to the style that fits within tblgen's DAG type but isn't (directly) a DAG. T...
2018 Nov 30
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...I haven't forgotten anything, there was a lot to keep track of :-). Overall, I think there's a couple places where things get a a little awkward (mainly debug info) but things generally look good to me. > > That's awesome :) > > >> _A Simple Example_ >> def : GICombineRule<(defs reg:$D, reg:$S), >> (match (G_ZEXT s32:$t1, s8:$S), >> (G_TRUNC s16:$D, s32:$t1)), >> (apply (G_ZEXT s16:$D, s8:$S))>; >> This has been converted to the style that fits within tblgen's DAG typ...
2018 Nov 12
3
[RFC] Tablegen-erated GlobalISel Combine Rules
...with_shift : GIMatchPredicate< >> (ins reg:$A), (outs uint64_t:$shift), MachineOperandPtr, [{ >> // MachineOperand *matchARMShiftedOp2(const MachineOperand &, uint64_t); >> return matchARMShiftedOp2(${A}, ${imm}); >> }]>; >> def : GICombineRule< >> (defs root:$D, reg:$S1, reg_with_shift:$S2), >> (match [{MIR %D = G_ADD %S1, %S2 }]), >> (apply [{MIR %D = ADD %S1, %S2, %S2.shift }])>; >> (I've just realized there's a gap in the ability to name metadata when used in this way. I've g...
2018 Nov 09
5
[RFC] Tablegen-erated GlobalISel Combine Rules
...re Combine Rules in tablegen and with the help of the people credited above I think we've ended up somewhere that should be nice to work with and opens up a lot of possibilities. Individual Combine Rules A Simple Example Here's a simple example that eliminates a redundant G_TRUNC. def : GICombineRule<(defs root:$D, operand:$S), (match [{MIR %1(s32) = G_ZEXT %S(s8) %D(s16) = G_TRUNC %1(s32) }]), (apply [{MIR %D(s16) = G_ZEXT %S(s8) }])>; There's three parts to this rule: defs declares the interface for the rule....
2018 Nov 10
3
[RFC] Tablegen-erated GlobalISel Combine Rules
...an example of a non-bool result: def reg_with_shift : GIMatchPredicate< (ins reg:$A), (outs uint64_t:$shift), MachineOperandPtr, [{ // MachineOperand *matchARMShiftedOp2(const MachineOperand &, uint64_t); return matchARMShiftedOp2(${A}, ${imm}); }]>; def : GICombineRule< (defs root:$D, reg:$S1, reg_with_shift:$S2), (match [{MIR %D = G_ADD %S1, %S2 }]), (apply [{MIR %D = ADD %S1, %S2, %S2.shift }])>; (I've just realized there's a gap in the ability to name metadata when used in this way. I've gone with 'S2.shift' for now)...
2018 Nov 09
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...asses? It would be nice to > re-use many of the rules, for example, except they'd match LLVM IR > rather than MIR. As you go about implementation, maybe keep this idea > in mind? > > > Here's a simple example that eliminates a redundant G_TRUNC. > > > > def : GICombineRule<(defs root:$D, operand:$S), > > (match [{MIR %1(s32) = G_ZEXT %S(s8) > > %D(s16) = G_TRUNC %1(s32) }]), > > (apply [{MIR %D(s16) = G_ZEXT %S(s8) }])>; > > The use of '%' vs. '$' here really threw me for a loop. I would have > expected '$D' a...
2018 Nov 28
3
[RFC] Tablegen-erated GlobalISel Combine Rules
...tCombine and MIR for combines that make sense to both isn't something I intend to work on but it does fit within the syntax proposed. > It would be something along the lines of: > class IRIndependentBinaryOp; > def IRIndependentAdd; > def IRIndependentMul; > def : GICombineRule<(defs ...), (match (IRIndependentMul $C, $A, 2)), (apply (IRIndependentAdd $C, $A, $A))>; > The backend(s) would need to know how to match and create LLVM-IR and MIR versions of IRIndependentMul and IRIndependentAdd much like the GlobalISel Combiner backend needs to know how to match and c...
2018 Nov 26
2
[RFC] Tablegen-erated GlobalISel Combine Rules
Hi Daniel, Thanks for the reply! Le lun. 26 nov. 2018 à 10:00, Daniel Sanders <daniel_l_sanders at apple.com> a écrit : > > Hi Quentin, > > Sorry for the slow reply. > > > On Nov 16, 2018, at 09:25, Quentin Colombet <quentin.colombet at gmail.com> wrote: > > > > Hi Daniel, > > > > I finally read the proposal. > > > > I have a
2018 Nov 28
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...ne and MIR for combines that > make sense to both isn't something I intend to work on but it does fit > within the syntax proposed. > It would be something along the lines of: > class IRIndependentBinaryOp; > def IRIndependentAdd; > def IRIndependentMul; > def : GICombineRule<(defs ...), (match (IRIndependentMul $C, $A, 2)), > (apply (IRIndependentAdd $C, $A, $A))>; > The backend(s) would need to know how to match and create LLVM-IR and MIR > versions of IRIndependentMul and IRIndependentAdd much like the GlobalISel > Combiner backend needs to know how...
2018 Nov 10
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...e G_* opcodes directly correspond to LLVM-IR instructions. The tricky bit will be the escape hatches into C++ would need to either have Instruction/MachineInstr versions or would need to accept both. >> Here's a simple example that eliminates a redundant G_TRUNC. >> >> def : GICombineRule<(defs root:$D, operand:$S), >> (match [{MIR %1(s32) = G_ZEXT %S(s8) >> %D(s16) = G_TRUNC %1(s32) }]), >> (apply [{MIR %D(s16) = G_ZEXT %S(s8) }])>; > > The use of '%' vs. '$' here really threw me for a loop. I would have > expected '$D' and...