-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[GlobalISel] Combine [S,U]SUBO #116489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GlobalISel] Combine [S,U]SUBO #116489
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1385,6 +1385,12 @@ def match_addos : GICombineRule< | |||
[{ return Helper.matchAddOverflow(*${root}, ${matchinfo}); }]), | ||||
(apply [{ Helper.applyBuildFn(*${root}, ${matchinfo}); }])>; | ||||
|
||||
def match_subo_no_overflow : GICombineRule< | ||||
(defs root:$root, build_fn_matchinfo:$matchinfo), | ||||
(match (wip_match_opcode G_SSUBO, G_USUBO):$root, | ||||
[{ return Helper.matchSuboCarryOut(*${root}, ${matchinfo}); }]), | ||||
(apply [{ Helper.applyBuildFn(*${root}, ${matchinfo}); }])>; | ||||
|
||||
def match_extract_of_element_undef_vector: GICombineRule < | ||||
(defs root:$root), | ||||
(match (G_IMPLICIT_DEF $vector), | ||||
|
@@ -1901,6 +1907,12 @@ def cmp_combines: GICombineGroup<[ | |||
redundant_binop_in_equality | ||||
]>; | ||||
|
||||
|
||||
def overflow_combines: GICombineGroup<[ | ||||
match_addos, | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These aren't artifacts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the legalizer builds addos while narrowing, e.g., adds:
Maybe artifacts is too strict. I stated in the summary that we import addos and the legalizer builds them while legalizing non addos. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That doesn't make them artifacts. There are lots of instructions that the legalizer builds like loads/stores but those aren't artifacts either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I need a mechanism to combine addos in AArch64PostLegalizerCombiner and I want to have a group where I/we can add more combines that run in the post legalizer combiner. Is it sufficient to rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't name these as post-legalizer combines in this file. Each target defines their own pipeline. Name the groups based on their category and then refer to them in any custom groups needed within AArch64Combine.td There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I splitted them again into two topic groups. |
||||
match_subo_no_overflow | ||||
]>; | ||||
|
||||
// FIXME: These should use the custom predicate feature once it lands. | ||||
def undef_combines : GICombineGroup<[undef_to_fp_zero, undef_to_int_zero, | ||||
undef_to_negative_one, | ||||
|
@@ -1984,9 +1996,9 @@ def all_combines : GICombineGroup<[integer_reassoc_combines, trivial_combines, | |||
and_or_disjoint_mask, fma_combines, fold_binop_into_select, | ||||
sub_add_reg, select_to_minmax, | ||||
fsub_to_fneg, commute_constant_to_rhs, match_ands, match_ors, | ||||
combine_concat_vector, match_addos, | ||||
combine_concat_vector, | ||||
sext_trunc, zext_trunc, prefer_sign_combines, shuffle_combines, | ||||
combine_use_vector_truncate, merge_combines]>; | ||||
combine_use_vector_truncate, merge_combines, overflow_combines]>; | ||||
|
||||
// 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 | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you just use
match
instead ofwip_match_opcode
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firstly, it was copy-pasted from
match_addos
above. Secondly, I believe we can match only one tree/graph per match. I can split it into two combines if you want.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like it either. There is no prior-art for matches with two output operands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a big deal, we can try to covert them en-masse in another change.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My real/only issue with
wip_match_opcode
is when the docstring says, e.g. G_FNEG(G_BUILD_VECTOR), and the user is doingwip_match_opcode
with G_FNEG. It looses precision.