This is an archive of the discontinued LLVM Phabricator instance.

[CSKY] Optimize conditional branch and value select with BTSTI
ClosedPublic

Authored by benshi001 on Jul 8 2023, 6:11 AM.

Diff Detail

Event Timeline

benshi001 created this revision.Jul 8 2023, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2023, 6:11 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
benshi001 requested review of this revision.Jul 8 2023, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2023, 6:11 AM
benshi001 updated this revision to Diff 538365.Jul 8 2023, 6:12 AM
benshi001 added inline comments.
llvm/test/CodeGen/CSKY/select.ll
8328

This test is not optimized with BTSTI due to the immediate 256 can be directly encoded into ANDI.

benshi001 updated this revision to Diff 538367.Jul 8 2023, 6:17 AM

Not sure why it reports patch application failed, but this patch did pass all tests on my localhost.

zixuan-wu added inline comments.Aug 4 2023, 12:16 AM
llvm/lib/Target/CSKY/CSKYInstrInfo.td
1251

can this opt also applied here?

benshi001 updated this revision to Diff 547225.Aug 4 2023, 8:16 AM
benshi001 marked an inline comment as done.
benshi001 added inline comments.
llvm/lib/Target/CSKY/CSKYInstrInfo.td
1251

Thanks. I have added that, and along with a test in llvm/test/CodeGen/CSKY/cmp-i.ll.

benshi001 marked an inline comment as done.Aug 4 2023, 8:17 AM
benshi001 added inline comments.
llvm/lib/Target/CSKY/CSKYInstrInfo.td
170

This is a typo in my previous commit. The max immediate can be directly encoded into ANDI32 is 0xfff, not 0xffff.

This is a typo, need not another patch.

zixuan-wu accepted this revision.Aug 7 2023, 10:43 PM
This revision is now accepted and ready to land.Aug 7 2023, 10:43 PM
This revision was landed with ongoing or failed builds.Aug 7 2023, 11:14 PM
This revision was automatically updated to reflect the committed changes.