[Openmcl-devel] Inline assembly?

R. Matthew Emerson rme at clozure.com
Wed Aug 26 11:34:38 PDT 2009

On Aug 26, 2009, at 6:08 AM, Jianshi Huang wrote:

> I'm reading the source code of ccl's backend. Currently the x86  
> backend
> does not support emitting SSE instructions.
> I'm wondering how much effort does it take to add SSE instruction
> support? Is alignment in the GC a problem?
> If only the compiler backend needs modification I'd like to volunteer
> for the work.

We do use some mmx/sse/sse2 instructions:  scalar floating point  
operations and some more exotic ones (like pmuldq) in bignum  
operations (see the source for %multiply-and-add-loop on a 64-bit  
lisp, for example), but it's true that the assembler doesn't recognize  
all of them.

These instructions are defined at around line 2987 of  

Adding more instructions is not too difficult once you figure out what  
the def-x86-opcode macro is expecting.

If you need 16-byte alignment (for instance, in order to use movapd or  
whatever), then you generally have to ensure proper alignment yourself  

All heap-allocated lisp objects are doublenode (8 bytes on x8632, 16  
bytes on x8664) aligned.  Double-floats are 8-byte aligned on both  
platforms.  The elements of vectors have natural alignment.

http://ccl.clozure.com/ccl-documentation.html#Tagging-scheme talks  
about how objects are represented in memory in a little more detail.

If you send a patch (or patches) to add more SSE instructions, I'll be  
glad to commit it.

If I'm not answering your questions, please don't hesitate to ask for  

More information about the Openmcl-devel mailing list