This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Fix BRKNS bug in optimizePTestInstr
ClosedPublic

Authored by c-rhodes on Oct 11 2022, 3:22 AM.

Details

Summary

The BRKNS instruction is unlike the other instructions that set flags
since it has an all active implicit predicate, so the existing

PTEST(PG, BRKN(PG, A, B)) -> BRKNS(PG, A, B)

in AArch64InstrInfo::optimizePTestInstr is incorrect, however

PTEST(PTRUE_B(31), BRKN(PG, A, B)) -> BRKNS(PG, A, B)

is correct.

Spotted by @paulwalker-arm in D134946.

Diff Detail

Event Timeline

c-rhodes created this revision.Oct 11 2022, 3:22 AM
c-rhodes requested review of this revision.Oct 11 2022, 3:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2022, 3:22 AM
paulwalker-arm added inline comments.Oct 11 2022, 7:51 AM
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
1359

What about "(MaskOpcode != AArch64::PTRUE_B)"?

1359–1360

With the above I doubt we need this.

c-rhodes updated this revision to Diff 466823.Oct 11 2022, 8:12 AM

Replace checks for is ptrue opcode + assert with single check for PTRUE_B opcode.

c-rhodes marked 2 inline comments as done.Oct 11 2022, 8:13 AM
c-rhodes added inline comments.
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
1359

What about "(MaskOpcode != AArch64::PTRUE_B)"?

that makes more sense, done

paulwalker-arm accepted this revision.Oct 11 2022, 9:54 AM
This revision is now accepted and ready to land.Oct 11 2022, 9:54 AM
Matt added a subscriber: Matt.Oct 11 2022, 11:50 AM
This revision was landed with ongoing or failed builds.Oct 12 2022, 1:35 AM
This revision was automatically updated to reflect the committed changes.
c-rhodes marked an inline comment as done.