This is an archive of the discontinued LLVM Phabricator instance.

[X86][Disassembler] Added SALC instruction
ClosedPublic

Authored by cray on Jan 26 2017, 3:39 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

cray created this revision.Jan 26 2017, 3:39 PM
craig.topper edited edge metadata.Jan 26 2017, 11:48 PM

Do other assemblers/disassembler handle this instruction? Its not officially documented and I wasn't able to determine for sure what other tools do. For ffreep I at least stumbled onto postings about gcc emitting it and AMD has or had it in the optimization manual.

I also noticed sandpile.org says salc doesn't work in 64-bit mode.

cray added a comment.Jan 27 2017, 9:06 AM

I know we have seen it in production code, but I can't remember what generated it currently. I just tested it with fasm and it assembled correctly. I was able to then disassemble it with IDA, and capstone.

Here is some good documentation on the instruction.
http://www.rcollins.org/secrets/opcodes/SALC.html

craig.topper added inline comments.Jan 28 2017, 4:21 PM
lib/Target/X86/X86InstrCMovSetCC.td
113 ↗(On Diff #85978)

I think we need a Requires<[Not64BitMode]> here. sandpile.org and http://www.agner.org/optimize/instruction_tables.pdf both indicate its not available in 64-bit mode.

Can you also add a comment that's it undocumented just so its obvious why you can't find it in Intel or AMD official docs.

Do other assemblers/disassembler handle this instruction? Its not officially documented and I wasn't able to determine for sure what other tools do. For ffreep I at least stumbled onto postings about gcc emitting it and AMD has or had it in the optimization manual.

I also noticed sandpile.org says salc doesn't work in 64-bit mode.

FWIW, xed knows about salc: https://github.com/intelxed/xed/blob/eb45a282de284ec2574e2b54460b37b7e587996c/datafiles/xed-isa.txt#L8011

cray updated this revision to Diff 86224.Jan 29 2017, 2:34 PM

Added Requires<[Not64BitMode]> to the SALC instruction, and added a comment saying that it is an undocumented instruction.

cray marked an inline comment as done.Jan 29 2017, 2:36 PM
This revision is now accepted and ready to land.Jan 29 2017, 2:47 PM
This revision was automatically updated to reflect the committed changes.