Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

Add disassembly for the conditioned RSUB immediate instruction for the ARC backend
ClosedPublic

Authored by thomasjohns on Jul 21 2021, 2:27 PM.

Details

Summary

This adds an entry for a conditioned RSUB with a register-register-u6 pattern (e.g. rsub.ne %r0, %r0, 31) in ARCInstrInfo.td and ARCInstrFormats.td and demonstrates the ability to decode this instruction from an object file.

For example, when disassembling the object file derived from compiling:

int f(int x) {
  return __builtin_clz(x);
}

we used to have:

00000000 <f>:
       0: 2f 28 13 80   <unknown>
       4: ca 20 21 08   mov.eq  %r0, 32
       8: e0 7f         j_s.d   [%blink]
       a: ce 20 e2 07   <unknown>

but now we have:

00000000 <f>:
       0: 2f 28 13 80   <unknown>
       4: ca 20 21 08   mov.eq  %r0, 32
       8: e0 7f         j_s.d   [%blink]
       a: ce 20 e2 07   rsub.ne %r0, %r0, 31

This also adds two test cases for the disassembly of MOVcc_ru6 which where accidently dropped from a previous revision: https://reviews.llvm.org/D105560.

Diff Detail

Event Timeline

thomasjohns created this revision.Jul 21 2021, 2:27 PM
thomasjohns requested review of this revision.Jul 21 2021, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2021, 2:27 PM
marksl added inline comments.Jul 21 2021, 3:01 PM
llvm/lib/Target/ARC/ARCInstrInfo.td
164

This form Refs=[STATUS32]

169

This form Defs=[STATUS32] and Refs=[STATUS32]

thomasjohns added inline comments.Jul 21 2021, 3:22 PM
llvm/lib/Target/ARC/ARCInstrInfo.td
169

Hi Mark, I'm not sure what Refs is referring to. Is there something that should be changed here?

marksl added inline comments.Jul 21 2021, 3:27 PM
llvm/lib/Target/ARC/ARCInstrInfo.td
169

Sorry, should be Uses=[STATUS32]

Annotate that _cc_f_rru6 uses STATUS32 flag.

marksl accepted this revision.Jul 22 2021, 10:39 AM
This revision is now accepted and ready to land.Jul 22 2021, 10:39 AM
This revision was landed with ongoing or failed builds.Jul 22 2021, 11:35 AM
This revision was automatically updated to reflect the committed changes.