This is an archive of the discontinued LLVM Phabricator instance.

[CSKY] Optimize ANDI/ORI to BCLRI/BSETI for specific immediates
ClosedPublic

Authored by benshi001 on Jun 23 2023, 12:54 AM.

Diff Detail

Event Timeline

benshi001 created this revision.Jun 23 2023, 12:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 12:54 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
benshi001 requested review of this revision.Jun 23 2023, 12:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 12:54 AM
benshi001 added inline comments.Jun 23 2023, 12:59 AM
llvm/test/CodeGen/CSKY/bseti_bclri.ll
54

This case will be optimized to (BSETI (BSETI x, 16), 2) in the future.

109

This case will be optimized to (BCLRI (BCLRI x, 16), 2) in the future.

benshi001 added inline comments.Jun 26 2023, 3:37 AM
llvm/test/CodeGen/CSKY/bseti_bclri.ll
7

This case is not optimized to BSETI due to the immediate can be directly encoded in to ORI32.

25

This case is not optimized to BSETI due to the immediate can be directly encoded in to ORI32.

64

This case can not be optimized to BCLRI due to the immediate can be directly encoded into ANDNI.

82

This case can not be optimized to BCLRI due to the immediate can be directly encoded into ANDNI.

99

This case can not be optimized to BCLRI due to the immediate has more the more than one zero-bit.

zixuan-wu accepted this revision.Aug 4 2023, 12:34 AM
This revision is now accepted and ready to land.Aug 4 2023, 12:34 AM
This revision was landed with ongoing or failed builds.Aug 4 2023, 1:11 AM
This revision was automatically updated to reflect the committed changes.