This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Use known zero bits when creating BIC
ClosedPublic

Authored by dmgreen on Jun 30 2023, 6:48 AM.

Details

Summary

If we know bits are already 0, we will not need to clear them again with a BIC. So we can use KnownBits to shrink the size of the constant in the creation BIC from And, potentially undoing the known-bits folds that happen during compilation.

BIC only has a single register operand for input and output, so has less scheduling freedom than a AND, but usually saves the materialization of a constant.

Diff Detail

Event Timeline

dmgreen created this revision.Jun 30 2023, 6:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2023, 6:48 AM
dmgreen requested review of this revision.Jun 30 2023, 6:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2023, 6:48 AM

(sort of related) I noticed issues back when trying to get https://github.com/llvm/llvm-project/issues/53881 fixed that BIC nodes didn't always have matching result / operand types - is that expected?

(sort of related) I noticed issues back when trying to get https://github.com/llvm/llvm-project/issues/53881 fixed that BIC nodes didn't always have matching result / operand types - is that expected?

I see what you mean. We do generate BICi very early - earlier than I would usually think was best.

For the matching types - I'm not sure. I would guess it was just something no-one has run into in the past, it doesn't appear the tablegen will notice that the types are different. It sounds fine to make sure they are the same with an NVCAST, as in d0e2930a21349cacf5cbf528447a590989849438.

samtebbs accepted this revision.Jul 4 2023, 3:09 AM

LGTM

This revision is now accepted and ready to land.Jul 4 2023, 3:09 AM
RKSimon accepted this revision.Jul 5 2023, 1:44 AM

LGTM - cheers

This revision was landed with ongoing or failed builds.Jul 5 2023, 7:42 AM
This revision was automatically updated to reflect the committed changes.