Sunday 3 July 2011

BASIC Assembler with VFP/SIMD (finally)

The VFP and SIMD extensions to the BBC BASIC assembler are working!  All of the instructions assemble from the test script.  Significantly more testing is required before a first release but I hope to publish something to the TBA downloads area in the not too distant future.

There are a few alterations to the official ARM syntax in order to accommodate the legacy BBC BASIC tokens and language syntax

1) In order to use an expression for a register number you have to specify the type followed by # and then an expression - for example Q#FNregister specifies a Quadword type register with a number returned from FNregister.

2) VDUP is currently renamed to VDPL as VDU is a keyword and VDUP.16 will get tokenized as VDUPRINT16 due to existing tokens.

3) Full encoding of floating point or 64bit immediate constants isn't supported, so there is a workaround where you can specify the immediate byte with a I64. F64. or F32. prefix.  This assumes you have encoded the value in a suitable way yourself which is better than nothing.  It must be said these immediate values are not exactly useful anyway.

4) The optional AL condition isn't supported on the unconditional SIMD instructions, and additional register type specifiers following the data-type are also not supported.

There are probably a few more options in the ARM syntax that are not supported - I'll have a go at reading through it all again to create some releases notes.

The to-do list

Error handling is still not integrated fully although this will be looked at next.  The current error numbers need evaluation to see how to include some additional VFP related messages.  I also expect there to be bugs (or undefined results) relating to use of incorrect syntax, and bugs relating to validation as it isn't possible to test every single invalid combination.  The current known bug list includes small things like optional brackets with a single register in a list, and specifying D0-D3 instead of D0,D1,D2,D3 on the VLDx/VSTx instructions.   Nothing major.

The final task is updating the help messages and creating some documentation so that the new instructions appear on the various help commands such as HELP [.   I'm also looking at adding a new command to display the VFP/SIMD assembler version and some debugging data to help with bug reporting.    The documentation will describe how the assembler and pattern tables work, along with how the BASIC version works that generates the optimized pattern tables for the assembler version.

It is quite easy to add additional non VFP/SIMD instructions to the pattern tables although I haven't started to look at what is currently missing.