This is an archive of the discontinued LLVM Phabricator instance.

[X86] convertIntLogicToFPLogic - enable fp-logic on pre-AVX targets for supported fp predicates (PR34563)
ClosedPublic

Authored by RKSimon on Mar 8 2022, 5:50 AM.

Details

Summary

If the SETCC fp-condcode is supported on SSE as a single CMPPS/PD op then we can use convertIntLogicToFPLogic to reduce EFLAGS and XMM->GPR traffic like we do for AVX targets.

Diff Detail

Event Timeline

RKSimon created this revision.Mar 8 2022, 5:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2022, 5:50 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
RKSimon requested review of this revision.Mar 8 2022, 5:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2022, 5:50 AM
pengfei added inline comments.Mar 8 2022, 6:09 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
46823–46825

What will we do if they are swapped? I don't see we use it else where.

46829–46830

Move the comments on line 46820 here?

RKSimon updated this revision to Diff 413791.Mar 8 2022, 6:38 AM

move comment

spatel added inline comments.Mar 8 2022, 7:00 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
46826

Make that a single "Unused" bool variable for readability? Or see next comment for an alternate change.

46829

Instead of an ambiguous "8", can we spell this out to make the limitation clear?

IIUC, this is what we want to avoid:

if (CC0 == ISD::SETONE || CC1 == ISD::SETONE ||
    CC0 == ISD::SETUEQ || CC1 == ISD::SETUEQ)

I see one other place in this file that uses this condition:

// In the two cases not handled by SSE compare predicates (SETUEQ/SETONE),
// emit two comparisons and a logic op to tie them together.

So we could create a small helper function to make both of these cases more obvious.

RKSimon updated this revision to Diff 413804.Mar 8 2022, 7:37 AM

Avoid translateX86FSETCC call

RKSimon updated this revision to Diff 413808.Mar 8 2022, 7:51 AM

Add cheapX86FSETCC_SSE helper - if we want to use this I'll pre-commit the helper

spatel accepted this revision.Mar 8 2022, 9:38 AM

LGTM

This revision is now accepted and ready to land.Mar 8 2022, 9:38 AM
This revision was landed with ongoing or failed builds.Mar 8 2022, 10:09 AM
This revision was automatically updated to reflect the committed changes.