This is an archive of the discontinued LLVM Phabricator instance.

[GlobalIsel][X86] Legalize G_BSWAP II
AbandonedPublic

Authored by tschuett on May 31 2023, 6:35 AM.

Details

Reviewers
RKSimon
arsenm
Summary

Note the workaround for 32 bit

Diff Detail

Event Timeline

tschuett created this revision.May 31 2023, 6:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 6:35 AM
tschuett requested review of this revision.May 31 2023, 6:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 6:35 AM
arsenm added inline comments.Jun 1 2023, 10:18 AM
llvm/test/CodeGen/X86/GlobalISel/legalize-bswap.mir
76 ↗(On Diff #527016)

Needs some non-power-of-2 tests

arsenm added inline comments.Jun 1 2023, 10:42 AM
llvm/test/CodeGen/X86/GlobalISel/legalize-bswap.mir
9 ↗(On Diff #527492)

I think something went wrong with the latest diff.

Anyway, you need a non-power-of-2 test in-between the clamped range. That's the case which wouldn't be caught if you dropped the widenScalarToNextPow2 part

tschuett updated this revision to Diff 527500.Jun 1 2023, 10:46 AM

second attempt

RKSimon added inline comments.Jun 1 2023, 10:52 AM
llvm/lib/Target/X86/X86LegalizerInfo.cpp
105

Add the sMax variable from D151878 instead of s64

127

If you're going to use legalIf, why not merge them (the plan is to get rid of the if (Subtarget.is64Bit()) if-else entirely):

return Query.Types[0] == s32 || (Subtarget.is64Bit() && Query.Types[0] == s64);