This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeTypes] Improve ExpandIntRes_XMULO codegen.
ClosedPublic

Authored by craig.topper on Feb 24 2021, 10:17 PM.

Details

Summary

The code previously used two BUILD_PAIRs to concatenate the two UMULO
results with 0s in the lower bits to match original VT. Then it created
an ADD and a UADDO with the original bit width. Each of those operations
need to be expanded since they have illegal types.

Since we put 0s in the lower bits before the ADD, the lower half of the
ADD result will be 0. So the lower half of the UADDO result is
solely determined by the other operand. Since the UADDO need to
be split in half, we don't really needd an operation for the lower
bits. Unfortunately, we don't see that in type legalization and end up
creating something more complicated and DAG combine or
lowering aren't always able to recover it.

This patch directly generates the narrower ADD and UADDO to avoid
needing to legalize them. Now only the MUL is done on the original
type.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 24 2021, 10:17 PM
craig.topper requested review of this revision.Feb 24 2021, 10:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2021, 10:17 PM
craig.topper edited the summary of this revision. (Show Details)Feb 24 2021, 10:28 PM
RKSimon accepted this revision.Mar 1 2021, 4:14 AM

LGTM

This revision is now accepted and ready to land.Mar 1 2021, 4:14 AM
This revision was automatically updated to reflect the committed changes.