This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Turn BIC creation into a DAG combine
ClosedPublic

Authored by nikic on Mar 10 2019, 1:58 AM.

Details

Summary

This is an alternative to the AArch64 part of D59174. Instead of checking for and x, -1 specifically, this turns the and to bic transformation from custom lowering to a custom DAG combine. This gives a chance for generic DAG combines to apply first.

Diff Detail

Repository
rL LLVM

Event Timeline

nikic created this revision.Mar 10 2019, 1:58 AM

I agree it doesn't really make sense to custom-lower this operation. That said, off the top of my head, I'm not sure why we're doing this at the DAG level at all, given the available instructions; it should be possible to pattern match (and x, (mvni imm)) during isel. (If there's some reason that doesn't work, a brief comment explaining it would be helpful.)

nikic added a comment.Mar 11 2019, 2:23 PM

I agree it doesn't really make sense to custom-lower this operation. That said, off the top of my head, I'm not sure why we're doing this at the DAG level at all, given the available instructions; it should be possible to pattern match (and x, (mvni imm)) during isel. (If there's some reason that doesn't work, a brief comment explaining it would be helpful.)

My guess would be that this would miss some cases that get lowered to (and x, (movi imm)), even though a representation using mvni would also be possible. The code for lowering constant build vectors first tries movi variants, then mvni, then movi with undef bits and finally mvni with undef bits.

Okay, that's reasonable; please add a comment to the code.

nikic updated this revision to Diff 190217.Mar 12 2019, 1:25 AM

Add comment on why this is not done in isel. Add updates to signed saturation tests added in the meantime.

nikic updated this revision to Diff 190881.Mar 15 2019, 12:45 PM
nikic marked an inline comment as done.

Fix typo in comment.

This revision is now accepted and ready to land.Mar 15 2019, 1:32 PM
This revision was automatically updated to reflect the committed changes.