This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Remove VBICimm if no cleared bits are demanded
ClosedPublic

Authored by dmgreen on Jul 17 2022, 10:06 AM.

Details

Summary

If none of the bits of a VBICimm are demanded, we can remove the node entirely using the input operand instead.

Diff Detail

Event Timeline

dmgreen created this revision.Jul 17 2022, 10:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2022, 10:06 AM
dmgreen requested review of this revision.Jul 17 2022, 10:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2022, 10:06 AM
samtebbs added inline comments.Jul 18 2022, 3:01 AM
llvm/lib/Target/ARM/ARMISelLowering.cpp
20004

Looks like VBIC uses the complement of the immediate. Does that need to be considered when checking Mask?

dmgreen added inline comments.Jul 18 2022, 11:54 PM
llvm/lib/Target/ARM/ARMISelLowering.cpp
20004

By "complement of the immediate", do you mean that it is the opposite of an And? If so then yes.
The way I think of it is that the BIC will clear any bits in the input where the mask is 1. If there are no bits that are cleared which are also demanded, then we don't need the BIC. In most of the tests the BIC is clearing the top bits (0xff00), which is a vmovl. The demanded bits are only the low bits (0x00ff).

samtebbs accepted this revision.Jul 19 2022, 1:58 AM

LGTM

llvm/lib/Target/ARM/ARMISelLowering.cpp
20004

I see, I interpreted the demanded bits as being those that should not be cleared. It all looks good with that clarification, thanks.

This revision is now accepted and ready to land.Jul 19 2022, 1:58 AM
This revision was landed with ongoing or failed builds.Jul 19 2022, 3:54 AM
This revision was automatically updated to reflect the committed changes.