Displaying 7 results from an estimated 7 matches for "create_imm".
Did you mean:
create_id
2018 Nov 27
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...(apply (MYTGT_DOUBLE $D, $A))>;
// $B/$C are needed to indicate they're immediates and provide $C's predicate
def : GICombineRule<
(defs reg:$D, reg:$A, imm:$B, imm_2:$C),
(match (G_ADD $t1, $A, $B),
(G_MUL $D, $t1, $C)),
(apply (create_imm [{ 2 * ${B}->getZExtValue() }], apint_value:$B):$NB,
(G_ADD $t1, $A, $A),
(G_ADD $D, $t1, $NB))>;
// $D is needed because we wanted operand instead of reg. We could rewrite the predicate to take a reg though.
def extending_loads : GICombineRule<
(def...
2018 Nov 30
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...LOAD $D, $A, 1)>;
or if a value like an offset needs passing, it would be something like:
def : GICombineRule<
(defs operand:$D, addr_plus_simm16:$A),
(match (G_LOAD $D, $A):$MI,
(mmo_is_load8 instr:$MI)
(is_addr_plus_simm16 operand:$A),
(apply (create_imm [{ ${A}.imm }], addr_plus_simm16:$A):$IMM),
(TGT_LOAD $D, $A, $IMM))>;
> Cheers,
> Nicolai
> --
> Lerne, wie die Welt wirklich ist,
> Aber vergiss niemals, wie sie sein sollte.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http...
2018 Nov 09
5
[RFC] Tablegen-erated GlobalISel Combine Rules
...2B which is achieved in this rule by creating a new operand before we generate the new instructions:
def : GICombineRule<
(defs root:$root, reg:$A, imm:$B, imm_2:$C),
(match [{MIR
%1 = G_ADD %A, %B
%root = G_MUL %1, %C
}]),
(apply (create_imm [{ 2 * ${B}->getZExtValue() }], apint_value:$B):$NB,
[{MIR %1 = G_ADD %A, %A
%root = G_ADD %1, %NB }])>;
In this definition the (create_imm ...):$NB creates a new operand with MachineOperand::CreateImm(...) and names it $NB for use in the pattern. The code bloc...
2018 Nov 30
2
[RFC] Tablegen-erated GlobalISel Combine Rules
...pply (MYTGT_DOUBLE $D, $A))>;
>> // $B/$C are needed to indicate they're immediates and provide $C's predicate
>> def : GICombineRule<
>> (defs reg:$D, reg:$A, imm:$B, imm_2:$C),
>> (match (G_ADD $t1, $A, $B),
>> (G_MUL $D, $t1, $C)),
>> (apply (create_imm [{ 2 * ${B}->getZExtValue() }], apint_value:$B):$NB,
>> (G_ADD $t1, $A, $A),
>> (G_ADD $D, $t1, $NB))>;
>> // $D is needed because we wanted operand instead of reg. We could rewrite the predicate to take a reg though.
>> def extending_loads : GICombineRule<
>...
2018 Nov 10
3
[RFC] Tablegen-erated GlobalISel Combine Rules
...ool, PreferredTuple> instead but that's less efficient (it would be an sret return on many targets) and would require us to define the truthiness (no examples of are in this email as I expect it to be a rare thing to need) in order to act as a predicate. Normally, you'd feed this into a (create_imm ...) or a (create_operand ...) in the apply section. However, in this particular case the data being passed determines the entirety of the replacement so we escape into arbitrary C++ instead and arrange for the variables to be injected appropriately using the 'exec' operator.
>
> Hav...
2018 Nov 27
3
[RFC] Tablegen-erated GlobalISel Combine Rules
...D, $A, $VAL)),
(apply (MYTGT_DOUBLE $D, $A))>;
And here's the example that replaces 2 * (A + B) with 2A + 2B:
def : GICombineRule<
(defs reg:$D, reg:$A, imm:$B, imm_2:$C),
(match (G_ADD $t1, $A, $B),
(G_MUL $D, $t1, $C)),
(apply (create_imm [{ 2 * ${B}->getZExtValue() }], apint_value:$B):$NB,
(G_ADD $t1, $A, $A),
(G_ADD $D, $t1, $NB))>;
Passing arbitrary data from match to apply
The main change in this section that hasn't already been discussed is that the result of extending_load_predicate has be...
2018 Nov 12
3
[RFC] Tablegen-erated GlobalISel Combine Rules
...ool, PreferredTuple> instead but that's less efficient (it would be an sret return on many targets) and would require us to define the truthiness (no examples of are in this email as I expect it to be a rare thing to need) in order to act as a predicate. Normally, you'd feed this into a (create_imm ...) or a (create_operand ...) in the apply section. However, in this particular case the data being passed determines the entirety of the replacement so we escape into arbitrary C++ instead and arrange for the variables to be injected appropriately using the 'exec' operator.
>>>...