This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Use S_BITCMP0_* to replace AND in optimizeCompareInstr
ClosedPublic

Authored by rampitec on Sep 1 2021, 3:08 PM.

Details

Summary

These can be used for reversed conditions if result of the AND
is unused except in the compare:

s_cmp_eq_u32 (s_and_b32 $src, 1), 0 => s_bitcmp0_b32 $src, 0
s_cmp_eq_i32 (s_and_b32 $src, 1), 0 => s_bitcmp0_b32 $src, 0
s_cmp_eq_u64 (s_and_b64 $src, 1), 0 => s_bitcmp0_b64 $src, 0
s_cmp_lg_u32 (s_and_b32 $src, 1), 1 => s_bitcmp0_b32 $src, 0
s_cmp_lg_i32 (s_and_b32 $src, 1), 1 => s_bitcmp0_b32 $src, 0
s_cmp_lg_u64 (s_and_b64 $src, 1), 1 => s_bitcmp0_b64 $src, 0

Diff Detail

Event Timeline

rampitec created this revision.Sep 1 2021, 3:08 PM
rampitec requested review of this revision.Sep 1 2021, 3:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 3:08 PM
Herald added a subscriber: wdng. · View Herald Transcript
alex-t accepted this revision.Sep 2 2021, 8:02 AM

LGTM

This revision is now accepted and ready to land.Sep 2 2021, 8:02 AM
This revision was landed with ongoing or failed builds.Sep 2 2021, 9:38 AM
This revision was automatically updated to reflect the committed changes.