This is an archive of the discontinued LLVM Phabricator instance.

[APInt] byteSwap - handle any whole byte bitwidth greater than 16-bits
ClosedPublic

Authored by RKSimon on Feb 15 2020, 4:27 AM.

Details

Summary

As noted on D74621, the bswap intrinsic has a self imposed limitation that the type's bitwidth must be divisible by 16, but there's no reason that APInt::byteSwap must have the same limitation, given that it can already handle any byte width.

Diff Detail

Event Timeline

RKSimon created this revision.Feb 15 2020, 4:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2020, 4:27 AM
lebedev.ri accepted this revision.Feb 15 2020, 4:46 AM

SGTM, i'm not sure why bswap intrinsic has that limitation.

This revision is now accepted and ready to land.Feb 15 2020, 4:46 AM

SGTM, i'm not sure why bswap intrinsic has that limitation.

I don't think it really does. Nothing is enforcing it, there's just a note in the LangRef

SGTM, i'm not sure why bswap intrinsic has that limitation.

I don't think it really does. Nothing is enforcing it, there's just a note in the LangRef

The legalizers probably assume it though.