This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Override hasAndNotCompare to use more andn when have Zbb extension.
ClosedPublic

Authored by jacquesguan on Dec 17 2021, 1:35 AM.

Details

Summary

Enable transform (X & Y) == Y ---> (~X & Y) == 0 and (X & Y) != Y ---> (~X & Y) != 0 when have Zbb extension to use more andn instruction.

Diff Detail

Event Timeline

jacquesguan created this revision.Dec 17 2021, 1:35 AM
jacquesguan requested review of this revision.Dec 17 2021, 1:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 17 2021, 1:35 AM
craig.topper added inline comments.Dec 17 2021, 9:17 AM
llvm/test/CodeGen/RISCV/rv32zbb-zbp.ll
562

Can you pre-commit the new test cases so we can see the change here?

jrtc27 added inline comments.Dec 17 2021, 9:38 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
1180

This is the default implementation

llvm/test/CodeGen/RISCV/rv32zbb-zbp.ll
561

Don't put double blank lines in

jacquesguan added inline comments.Dec 19 2021, 7:47 PM
llvm/test/CodeGen/RISCV/rv32zbb-zbp.ll
562

Done, I added a precommit test in https://reviews.llvm.org/D116013.

remove hasAndNot and format test.

jacquesguan added inline comments.Dec 19 2021, 10:27 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
1180

Done

llvm/test/CodeGen/RISCV/rv32zbb-zbp.ll
561

Done

luismarques added inline comments.Dec 20 2021, 3:15 AM
llvm/test/CodeGen/RISCV/rv32zbb-zbp.ll
562

This diff doesn't yet reflect the separate test patch. You don't need to wait for the other patch to be accepted to update the diff here. You can use the other patch as the diff baseline and add it as a parent revision to this one.

rebase to pre-commit test.

jacquesguan added inline comments.Dec 20 2021, 4:54 AM
llvm/test/CodeGen/RISCV/rv32zbb-zbp.ll
562

Done, I rebase to the pre-commit test, now the diff is OK.

Update test.

This revision is now accepted and ready to land.Dec 22 2021, 7:36 AM
This revision was landed with ongoing or failed builds.Dec 22 2021, 6:51 PM
This revision was automatically updated to reflect the committed changes.