Page MenuHomePhabricator

[X86] Move integer hadd/hsub formation into a helper function shared by combineAdd and combineSub.
ClosedPublic

Authored by craig.topper on Jul 16 2020, 11:13 AM.

Details

Summary

There was a lot of duplicate code here for checking the VT and
subtarget. Moving it into a helper avoids that.

It also fixes a bug that combineAdd reused Op0/Op1 after a call
to isHorizontalBinOp may have changed it. The new helper function
has its own local version of Op0/Op1 that aren't shared by other
code.

Fixes PR46455.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 16 2020, 11:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2020, 11:13 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
bkramer accepted this revision.Jul 16 2020, 11:26 AM
bkramer added a subscriber: bkramer.

This fixes the miscompile I was seeing. Thanks!

This revision is now accepted and ready to land.Jul 16 2020, 11:26 AM
spatel accepted this revision.Jul 16 2020, 11:41 AM

LGTM; we were already looking at doing this as part of D83789.

This revision was automatically updated to reflect the committed changes.