Page MenuHomePhabricator

Fix 64-bit copy to SCC
ClosedPublic

Authored by piotr on Aug 4 2020, 6:22 AM.

Details

Summary

Fix 64-bit copy to SCC by restricting the pattern resulting
in such a copy to subtargets supporting 64-bit scalar compare,
and mapping the copy to S_CMP_LG_U64.

Before introducing the S_CSELECT pattern with explicit SCC
(0045786f146e78afee49eee053dc29ebc842fee1), there was no need
for handling 64-bit copy to SCC ($scc = COPY sreg_64).

The proposed handling to read only the low bits was however
based on a false premise that it is only one bit that matters,
while in fact the copy source might be a vector of booleans and
all bits need to be considered.

The practical problem of mapping the 64-bit copy to SCC is that
the natural instruction to use (S_CMP_LG_U64) is not available
on old hardware. Fix it by restricting the problematic pattern
to subtargets supporting the instruction (hasScalarCompareEq64).

Diff Detail

Event Timeline

piotr created this revision.Aug 4 2020, 6:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2020, 6:22 AM
piotr requested review of this revision.Aug 4 2020, 6:22 AM
piotr added a reviewer: arsenm.Aug 4 2020, 6:25 AM
piotr added a subscriber: alex-t.Aug 4 2020, 6:31 AM

@alex-t for awareness, as the code I am changing here was mentioned in https://reviews.llvm.org/D82194#2117180.

nhaehnle accepted this revision.Aug 6 2020, 1:39 AM

LGTM

This revision is now accepted and ready to land.Aug 6 2020, 1:39 AM
This revision was automatically updated to reflect the committed changes.