Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/Target/GlobalISel/Combine.td
Show First 20 Lines • Show All 926 Lines • ▼ Show 20 Lines | |||||
// Transform (add (sub y, x), x) -> y | // Transform (add (sub y, x), x) -> y | ||||
def add_sub_reg: GICombineRule < | def add_sub_reg: GICombineRule < | ||||
(defs root:$root, register_matchinfo:$matchinfo), | (defs root:$root, register_matchinfo:$matchinfo), | ||||
(match (wip_match_opcode G_ADD):$root, | (match (wip_match_opcode G_ADD):$root, | ||||
[{ return Helper.matchAddSubSameReg(*${root}, ${matchinfo}); }]), | [{ return Helper.matchAddSubSameReg(*${root}, ${matchinfo}); }]), | ||||
(apply [{ return Helper.replaceSingleDefInstWithReg(*${root}, | (apply [{ return Helper.replaceSingleDefInstWithReg(*${root}, | ||||
${matchinfo}); }])>; | ${matchinfo}); }])>; | ||||
def buildvector_identity_fold : GICombineRule< | |||||
(defs root:$build_vector, register_matchinfo:$matchinfo), | |||||
(match (wip_match_opcode G_BUILD_VECTOR_TRUNC, G_BUILD_VECTOR):$build_vector, | |||||
[{ return Helper.matchBuildVectorIdentityFold(*${build_vector}, ${matchinfo}); }]), | |||||
(apply [{ Helper.replaceSingleDefInstWithReg(*${build_vector}, ${matchinfo}); }])>; | |||||
def trunc_buildvector_fold : GICombineRule< | |||||
(defs root:$op, register_matchinfo:$matchinfo), | |||||
(match (wip_match_opcode G_TRUNC):$op, | |||||
[{ return Helper.matchTruncBuildVectorFold(*${op}, ${matchinfo}); }]), | |||||
(apply [{ Helper.replaceSingleDefInstWithReg(*${op}, ${matchinfo}); }])>; | |||||
def select_to_minmax: GICombineRule< | def select_to_minmax: GICombineRule< | ||||
(defs root:$root, build_fn_matchinfo:$info), | (defs root:$root, build_fn_matchinfo:$info), | ||||
(match (wip_match_opcode G_SELECT):$root, | (match (wip_match_opcode G_SELECT):$root, | ||||
[{ return Helper.matchSimplifySelectToMinMax(*${root}, ${info}); }]), | [{ return Helper.matchSimplifySelectToMinMax(*${root}, ${info}); }]), | ||||
(apply [{ Helper.applyBuildFn(*${root}, ${info}); }])>; | (apply [{ Helper.applyBuildFn(*${root}, ${info}); }])>; | ||||
// FIXME: These should use the custom predicate feature once it lands. | // FIXME: These should use the custom predicate feature once it lands. | ||||
def undef_combines : GICombineGroup<[undef_to_fp_zero, undef_to_int_zero, | def undef_combines : GICombineGroup<[undef_to_fp_zero, undef_to_int_zero, | ||||
undef_to_negative_one, | undef_to_negative_one, | ||||
binop_left_undef_to_zero, | binop_left_undef_to_zero, | ||||
binop_right_undef_to_undef, | binop_right_undef_to_undef, | ||||
propagate_undef_any_op, | propagate_undef_any_op, | ||||
propagate_undef_all_ops, | propagate_undef_all_ops, | ||||
propagate_undef_shuffle_mask, | propagate_undef_shuffle_mask, | ||||
erase_undef_store, | erase_undef_store, | ||||
unmerge_undef, | unmerge_undef, | ||||
insert_extract_vec_elt_out_of_bounds]>; | insert_extract_vec_elt_out_of_bounds]>; | ||||
def identity_combines : GICombineGroup<[select_same_val, right_identity_zero, | def identity_combines : GICombineGroup<[select_same_val, right_identity_zero, | ||||
binop_same_val, binop_left_to_zero, | binop_same_val, binop_left_to_zero, | ||||
binop_right_to_zero, p2i_to_i2p, | binop_right_to_zero, p2i_to_i2p, | ||||
i2p_to_p2i, anyext_trunc_fold, | i2p_to_p2i, anyext_trunc_fold, | ||||
fneg_fneg_fold, right_identity_one, | fneg_fneg_fold, right_identity_one, | ||||
add_sub_reg]>; | add_sub_reg, buildvector_identity_fold, | ||||
trunc_buildvector_fold]>; | |||||
def const_combines : GICombineGroup<[constant_fp_op, const_ptradd_to_i2p, | def const_combines : GICombineGroup<[constant_fp_op, const_ptradd_to_i2p, | ||||
overlapping_and, mulo_by_2, mulo_by_0, | overlapping_and, mulo_by_2, mulo_by_0, | ||||
addo_by_0, adde_to_addo, | addo_by_0, adde_to_addo, | ||||
combine_minmax_nan]>; | combine_minmax_nan]>; | ||||
def known_bits_simplifications : GICombineGroup<[ | def known_bits_simplifications : GICombineGroup<[ | ||||
redundant_and, redundant_sext_inreg, redundant_or, urem_pow2_to_mask, | redundant_and, redundant_sext_inreg, redundant_or, urem_pow2_to_mask, | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |