Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/Target/GlobalISel/Combine.td
Show First 20 Lines • Show All 636 Lines • ▼ Show 20 Lines | |||||
def trunc_ext_fold_matchinfo : GIDefMatchData<"std::pair<Register, unsigned>">; | def trunc_ext_fold_matchinfo : GIDefMatchData<"std::pair<Register, unsigned>">; | ||||
def trunc_ext_fold: GICombineRule < | def trunc_ext_fold: GICombineRule < | ||||
(defs root:$root, trunc_ext_fold_matchinfo:$matchinfo), | (defs root:$root, trunc_ext_fold_matchinfo:$matchinfo), | ||||
(match (wip_match_opcode G_TRUNC):$root, | (match (wip_match_opcode G_TRUNC):$root, | ||||
[{ return Helper.matchCombineTruncOfExt(*${root}, ${matchinfo}); }]), | [{ return Helper.matchCombineTruncOfExt(*${root}, ${matchinfo}); }]), | ||||
(apply [{ Helper.applyCombineTruncOfExt(*${root}, ${matchinfo}); }]) | (apply [{ Helper.applyCombineTruncOfExt(*${root}, ${matchinfo}); }]) | ||||
>; | >; | ||||
// Fold trunc (shl x, K) -> shl (trunc x), K => K < VT.getScalarSizeInBits(). | // Under certain conditions, transform: | ||||
def trunc_shl_matchinfo : GIDefMatchData<"std::pair<Register, Register>">; | // trunc (shl x, K) -> shl (trunc x), K// | ||||
def trunc_shl: GICombineRule < | // trunc ([al]shr x, K) -> (trunc ([al]shr (trunc x), K)) | ||||
(defs root:$root, trunc_shl_matchinfo:$matchinfo), | def trunc_shift_matchinfo : GIDefMatchData<"std::pair<MachineInstr*, LLT>">; | ||||
def trunc_shift: GICombineRule < | |||||
(defs root:$root, trunc_shift_matchinfo:$matchinfo), | |||||
(match (wip_match_opcode G_TRUNC):$root, | (match (wip_match_opcode G_TRUNC):$root, | ||||
[{ return Helper.matchCombineTruncOfShl(*${root}, ${matchinfo}); }]), | [{ return Helper.matchCombineTruncOfShift(*${root}, ${matchinfo}); }]), | ||||
(apply [{ Helper.applyCombineTruncOfShl(*${root}, ${matchinfo}); }]) | (apply [{ Helper.applyCombineTruncOfShift(*${root}, ${matchinfo}); }]) | ||||
>; | >; | ||||
// Transform (mul x, -1) -> (sub 0, x) | // Transform (mul x, -1) -> (sub 0, x) | ||||
def mul_by_neg_one: GICombineRule < | def mul_by_neg_one: GICombineRule < | ||||
(defs root:$root), | (defs root:$root), | ||||
(match (wip_match_opcode G_MUL):$root, | (match (wip_match_opcode G_MUL):$root, | ||||
[{ return Helper.matchConstantOp(${root}->getOperand(2), -1); }]), | [{ return Helper.matchConstantOp(${root}->getOperand(2), -1); }]), | ||||
(apply [{ Helper.applyCombineMulByNegativeOne(*${root}); }]) | (apply [{ Helper.applyCombineMulByNegativeOne(*${root}); }]) | ||||
▲ Show 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | def all_combines : GICombineGroup<[trivial_combines, insert_vec_elt_combines, | ||||
combine_indexed_load_store, undef_combines, identity_combines, phi_combines, | combine_indexed_load_store, undef_combines, identity_combines, phi_combines, | ||||
simplify_add_to_sub, hoist_logic_op_with_same_opcode_hands, | simplify_add_to_sub, hoist_logic_op_with_same_opcode_hands, | ||||
reassocs, ptr_add_immed_chain, | reassocs, ptr_add_immed_chain, | ||||
shl_ashr_to_sext_inreg, sext_inreg_of_load, | shl_ashr_to_sext_inreg, sext_inreg_of_load, | ||||
width_reduction_combines, select_combines, | width_reduction_combines, select_combines, | ||||
known_bits_simplifications, ext_ext_fold, | known_bits_simplifications, ext_ext_fold, | ||||
not_cmp_fold, opt_brcond_by_inverting_cond, | not_cmp_fold, opt_brcond_by_inverting_cond, | ||||
unmerge_merge, unmerge_cst, unmerge_dead_to_trunc, | unmerge_merge, unmerge_cst, unmerge_dead_to_trunc, | ||||
unmerge_zext_to_zext, merge_unmerge, trunc_ext_fold, trunc_shl, | unmerge_zext_to_zext, merge_unmerge, trunc_ext_fold, trunc_shift, | ||||
const_combines, xor_of_and_with_same_reg, ptr_add_with_zero, | const_combines, xor_of_and_with_same_reg, ptr_add_with_zero, | ||||
shift_immed_chain, shift_of_shifted_logic_chain, load_or_combine, | shift_immed_chain, shift_of_shifted_logic_chain, load_or_combine, | ||||
truncstore_merge, div_rem_to_divrem, funnel_shift_combines, | truncstore_merge, div_rem_to_divrem, funnel_shift_combines, | ||||
form_bitfield_extract, constant_fold, fabs_fneg_fold, | form_bitfield_extract, constant_fold, fabs_fneg_fold, | ||||
intdiv_combines, mulh_combines, redundant_neg_operands, | intdiv_combines, mulh_combines, redundant_neg_operands, | ||||
and_or_disjoint_mask, fma_combines, fold_binop_into_select, | and_or_disjoint_mask, fma_combines, fold_binop_into_select, | ||||
sub_add_reg, select_to_minmax, redundant_binop_in_equality, | sub_add_reg, select_to_minmax, redundant_binop_in_equality, | ||||
fsub_to_fneg]>; | fsub_to_fneg]>; | ||||
// A combine group used to for prelegalizer combiners at -O0. The combines in | // A combine group used to for prelegalizer combiners at -O0. The combines in | ||||
// this group have been selected based on experiments to balance code size and | // this group have been selected based on experiments to balance code size and | ||||
// compile time performance. | // compile time performance. | ||||
def optnone_combines : GICombineGroup<[trivial_combines, | def optnone_combines : GICombineGroup<[trivial_combines, | ||||
ptr_add_immed_chain, combines_for_extload, | ptr_add_immed_chain, combines_for_extload, | ||||
not_cmp_fold, opt_brcond_by_inverting_cond]>; | not_cmp_fold, opt_brcond_by_inverting_cond]>; |