[Openmcl-devel] CCL on a Raspberry pi

Gary Byers gb at clozure.com
Sat Jul 21 12:06:20 PDT 2012


Late-breaking news:

A customer is interested in using an ARMv6 in a project, so there's more
incentive to support CCL on that (slightly) different architecture.

>From CCL's point of view, the biggest differences between ARMv6 and ARMv7-a
are:

- the v7 supports some instructions that make it easier to move 16- and 32-bit
   constants to registers [1].
- the v7 does some out-of-order memory access; on multiprocessor systems, some
   things require that v7-specific "memory barrier" instructions are
   used to ensure that all processors are in synch when they need to be.

Those are small but not-entirely-insignificant changes.  The
memory-barrier stuff is critical but localized.  The stuff to access
wider constants isn't critical, but it's fairly common and if we can
use the newer instructions it's nice to be able to do that.  (It's
common enough that it'd probably be undesirable to emulate those
instuctions on a v6.)  I lean towards having a separate ARMv6 port
(that would run on a v7 as well), and would lean further if it wasn't
a little silly to have a separate CCL port for something so similar
to an existing port.

---
[1] If anyone's really interested: most ARM ALU instructions (including
MOV) allow one operand to be an 8-bit constant, rotated by an even number
of bits.  (The ARM also supports MVN, which moves the 1-s complement of
an operand to a register.)  So:

   (mov r0 (:$ #xff)) ; mov 255 to r0
   (mov ro (:$ #xff00)) ; move 255 rotated left 8 bits to r0
   (mvn r0 (:$ #xff)) ; mov #xffffff00 to r0

a lot of insteresting constants can be loaded into a register.  If #x1234
is "interesting", the traditional way of moving it to a register is something
like:

   (mov r0 (:$ #x34)) ; mov low byte
   (orr r0 r0 (:$ #x1200)) ; LOGIOR in the high byte

Obviously, there are several equivalent ways of doing this.

On an ARMv7, a "movw" instruction can be used to load a 16-bit constant into
a register in a single instruction:

   (movw r0 (:$ #x1234)) ; zeros the upper 16 bits of destination

The ARMv7 also offers a "movt" instruction, which sets the upper 16 bits of
the destination, so moving #x12345678 to r0 is:

   (movw r0 (:$ #x5678))
   (movt r0 (:$ #x1234))

which is a bit shorter/faster than the traditional way (an 8-bit MOV followed
by 3 ORRs, or maybe even loading the constant from memory.)

The 16-bit case is fairly common in compiled code, so if we stopped using MOVW
some code would be a little bigger and maybe a little slower (I'm not even sure
if this would be measurable) but that code would run on an ARMv6.

Don't blame me.  You COULD have skipped this explanation ...

On Sat, 21 Jul 2012, Stas Boukarev wrote:

> Ron Garret <ron at flownet.com> writes:
>
>> Has anyone run CCL on a Raspberry Pi or know of a reason why it wouldn't work?
> Raspberry Pi has armv6 and CCL only supports armv7.
>
> -- 
> With best regards, Stas.
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list