This is an archive of the discontinued LLVM Phabricator instance.

[SPARC] Improve integer branch handling for v9 targets
ClosedPublic

Authored by koakuma on Jul 18 2022, 6:26 AM.

Details

Summary

Do not emit deprecated v8-style branches when targeting a v9 processor.
As a side effect, this also fixes the emission of useless bas when doing conditional branches on 64-bit integer values.

Diff Detail

Event Timeline

koakuma created this revision.Jul 18 2022, 6:26 AM
koakuma requested review of this revision.Jul 18 2022, 6:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 6:26 AM
koakuma added inline comments.Jul 18 2022, 6:28 AM
llvm/lib/Target/Sparc/SparcInstrInfo.td
863–864

Is this enough, or do I also need to create custom lowering like LowerBR_CC?

koakuma updated this revision to Diff 450280.Aug 5 2022, 6:34 AM

Add some comment wrt BPA emission.

brad added a reviewer: ro.Aug 21 2022, 9:44 PM

Ping. Is there anything else I should do for this?

koakuma updated this revision to Diff 466288.Oct 8 2022, 8:38 AM

Change LowerBR_CC to use already-created isV9 rather than passing Subtarget again.

arsenm added a subscriber: arsenm.Oct 8 2022, 9:33 AM
arsenm added inline comments.
llvm/lib/Target/Sparc/SparcISelLowering.cpp
3235

No return after else

llvm/lib/Target/Sparc/SparcInstrInfo.cpp
287

Shouldn't rely on a subtarget check should rely on the opcode behaviors. Otherwise you are dependent on specific selection behavior

koakuma updated this revision to Diff 466336.Oct 8 2022, 8:49 PM
  • Change codestyle as suggested
  • Change parseCondBranch/insertBranch to pass the branch opcode instead of relying on subtarget checking
koakuma updated this revision to Diff 469866.Oct 22 2022, 1:10 AM

Update the new tests to use update_llc_test_checks.py results.

koakuma updated this revision to Diff 471545.Oct 28 2022, 7:35 AM

Set cc = 0b00 in BPA instruction definition.

arsenm accepted this revision.Nov 16 2022, 3:15 PM

LGTM

This revision is now accepted and ready to land.Nov 16 2022, 3:15 PM
This revision was automatically updated to reflect the committed changes.