3 ms·
Does the SBCL compiler use a separate third-party assembler? Otherwise, how does it know the POPCNT opcode/encoding? I didn't see the author specify it in the p
by talder 12y ago
Does the SBCL compiler use a separate third-party assembler? Otherwise, how does it know the POPCNT opcode/encoding? I didn't see the author specify it in the post.
- sedachv 12y agoSBCL comes with its own assembler: https://github.com/sbcl/sbcl/blob/master/src/compiler/assem.lisp https://github.com/sbcl/sbcl/blob/master/src/compiler/assem....
- _delirium 12y agoAnd the instructions themselves are defined here (e.g. for x86-64): https://github.com/sbcl/sbcl/blob/master/src/compiler/x86-64/insts.lisp https://github.com/sbcl/sbcl/blob/master/src/compiler/x86-64... I think the question might've been how you can just write things like (instr popcnt...) and expect SBCL to know how to emit the right machine code for popcnt. It's mentioned briefly at the top, but the answer is that this post isn't adding the instruction (it would indeed not work if it were a new instruction SBCL doesn't yet know about). The example is just walking through modifying how it's generated by the VOPs, the code-generation level that sits a level above the assembler. The popcnt instruction itself had already been added to SBCL some time ago, with the define-instruction seen in the link above.