This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Armv8-R DFB instruction
ClosedPublic

Authored by samparker on Dec 20 2017, 2:01 AM.

Details

Summary

Implement MC support for the Armv8-R 'Data Full Barrier' instruction.

Diff Detail

Event Timeline

samparker created this revision.Dec 20 2017, 2:01 AM
fhahn added a subscriber: fhahn.Dec 20 2017, 2:10 AM
fhahn added inline comments.
lib/Target/ARM/ARM.td
89

I would just use a single new line here.

lib/Target/ARM/ARMInstrInfo.td
4813

Are you sure about Sched<[WriteALU]>? It's an alias to the DSB instruction , which does not have a similar Sched

lib/Target/ARM/ARMInstrThumb2.td
3197

Same comment about Sched<[WriteALU]>

samparker added inline comments.Dec 20 2017, 2:43 AM
lib/Target/ARM/ARM.td
89

cheers.

lib/Target/ARM/ARMInstrInfo.td
4813

I'm not, but couldn't find where/how DSB got its scheduling info. Do you know where its defined? I should probably also add an InstAlias to DSB...

fhahn added a comment.Dec 20 2017, 3:12 AM

This is the only new instruction added in Armv8-r, right? I assume this is the reason you added a very specific target feature for it (rather than something like armv8-r)? I think this also the reason you had to add 4 separate tiny test files? This is slightly unfortunate, but matches with the way things are done currently.

lib/Target/ARM/ARMInstrInfo.td
4813

The instruction is marked as having (unmodelled) side effects. That should tell the scheduler to not move instructions past this instruction, so I think there is no need to add scheduling info.

test/MC/Disassembler/ARM/dfb-arm.txt
1

Please remove SDCOMP-27699.

test/MC/Disassembler/ARM/dfb-thumb.txt
1

Please remove SDCOMP-27699.

javed.absar added inline comments.Dec 20 2017, 3:19 AM
lib/Target/ARM/ARMInstrInfo.td
4813

As this is memory relate WriteLd may be a better option (and probably more realistic in terms of timing generally).

sdesmalen added inline comments.Dec 20 2017, 3:33 AM
lib/Target/ARM/ARMInstrInfo.td
4813

Having an InstAlias to DSB instead of a new instruction allows you to reuse the original instruction definition (and not have to worry about scheduling models).
TableGen usually errors when it finds a collision in instruction encodings, so I'm surprised it doesn't for this case (i.e. this instruction would collide with DSB instruction with immediate #0xc).

samparker added inline comments.Dec 20 2017, 3:35 AM
lib/Target/ARM/ARMInstrInfo.td
4813

Yes, cheers, this is what I'm doing instead.

test/MC/Disassembler/ARM/dfb-arm.txt
1

Thanks!

@sdesmalen The architecture manual states that DFB is always the preferred disassembly output. So do you know if its possible to do an InstAlias which would produce the 'dfb' string when a dsb #12 is disassembled? Seems cleaner to me to remove the instruction definition, but I'm not sure thats its trivial.

@sdesmalen The architecture manual states that DFB is always the preferred disassembly output. So do you know if its possible to do an InstAlias which would produce the 'dfb' string when a dsb #12 is disassembled? Seems cleaner to me to remove the instruction definition, but I'm not sure thats its trivial.

You can set the EmitPriority to 1 (or higher) so that it is always printed when 'dsb #12' is disassembled. (See the comments in include/llvm/Target/Target.td for EmitPriority).

great, i'll try that. thanks

samparker updated this revision to Diff 127696.Dec 20 2017, 5:58 AM

Removed whitespace changes and SDCOMP messages and also removed the instruction definitions in favour of using aliases.

sdesmalen added inline comments.Dec 20 2017, 6:07 AM
lib/Target/ARM/ARMInstrThumb2.td
4512

Thanks for making this change. Also, if you change the last parameter of InstAlias to '1', you don't need to set EmitPriority=1.
i.e.

IntAlias<"dfb${p}", (t2DSB 0xc, pred:$p), 1>, Requires<[HasDFB]>;
samparker added inline comments.Dec 20 2017, 6:22 AM
lib/Target/ARM/ARMInstrThumb2.td
4512

Ah! Will do

samparker updated this revision to Diff 127707.Dec 20 2017, 6:29 AM

Passing '1' to set EmitPriority.

sdesmalen accepted this revision.Dec 20 2017, 7:13 AM

Passing '1' to set EmitPriority.

Thanks, it looks much better now.

This revision is now accepted and ready to land.Dec 20 2017, 7:13 AM
fhahn accepted this revision.Dec 20 2017, 7:13 AM

LGTM thanks Sam

fhahn added a comment.Dec 20 2017, 7:15 AM

nit: Maybe use [ARM] Add Armv8-R DFB instruction. as a title?

Thanks for the review. Would either of you mind committing this for me? My computer has just been taken for a rebuild.

fhahn added a comment.Dec 20 2017, 7:19 AM

Thanks for the review. Would either of you mind committing this for me? My computer has just been taken for a rebuild.

I could commit it for your, but I think it's fine to commit this in a couple of days.

Ok, no worries then.

This revision was automatically updated to reflect the committed changes.