Hello, this is Dr. Miller, and this
is Episode twelve point three of
Assembly today we're
going to talk about Victor Floating
Point, VFP and
Neon UNarm.
So floating point.
So Inam we have the VPP
or vector floating point and this
was traditionally a separate Kroko
processor.
It was on armed versions prior to
version eight.
And then we also have traditional
VPP and neon instructions
that both provide together both
single and double precision
floating point operations.
So they provide the ability that an
arm processor can do floating point.
So for floating point instructions,
we have VPP versus Nean.
So both VPP and Neon
are optional extensions to the ARM
architecture. So whoever
the manufacturer is, if it's Apple
or if it's a Raspberry Pi, they
get to decide what optional
extensions they want to add to ARM.
And so Nehan add some new
instructions that VPP didn't have.
And so what we end up with is
traditionally we'll have a mixed
mode operation on sort of newer
processors.
So we'll have some instructions that
are VPP only some instructions are
mixed and then some instructions are
Nehan only.
And then when you're using a device
you'll need to review the ARM
documentation and the processor
version to see what types of
instructions you can use on your
processor.
So, for example, the Raspberry Pi
uses VPP version four, which
has both neon
and VPP instructions
together, and we've added that to
our compiler option so that we can
compile code for it.
So here's an example.
So we have PI,
which is a floating point, number
three point one four one five,
and so we can
load that address into our zero.
So LDI are zero.
The address of PI, we
can copy the data
from our zero
into our two and our three
and then we can do a floating point
move. So if we move into
zero or reloading a floating
point number from R to sort of use
our two and our three.
And so when we look at that in the
code, we can see that R2 gets
this value, our three gets this
value.
And then if we look at the data at
that location, we can see that those
two pieces of data match
and then we go and print dollar
sign zero.
We can see that zero is two point
one four one five.
So we have additional operations
that we can do, we can do things
like we can add to numbers so
Vaid so we're doing a vector
add and then we're saying we want to
do a floating point thirty two bit
number, so we'll take
X and Y and we'll add
them together and store them in D
for the destination.
Or we can take X and Y and we can
subtract them, we can do
multiplication and we can do
division.
And you have to look at the armed
documentation to understand
the different types of operations
that you're going to do.
We're going to have sort of more
complicated. So we got negate and
multiply.
So you take the two together,
multiply them together, multiply
by negative one, and then
store that result in SD.
Or we can do an absolute value
or we can do multiply and
accumulate. So the destination
would be the the destination plus
six times s y and
so we can do again all of that in
floating point using the.
The M four multiply
and accumulate operation.
We can also take and convert
from single precision to double
precision, and so that's
the convert so we can do convert
again. We see a conditional it's an
optional conditional code
and then we can save it
into a double precision
register or a single precision
register if we're going up or down.
So here we're going from
a 32 bit register
to a 64 bit register, and here
we're going from a 64 bit registered
to a 30 to register.
So you just have to look up the
right one so that you can get the
right conversion in the right source
and destination.
And so we can see here, we
can take our big, which is
a float and it's got a thousand
and so we can again load that
address, we can use
Eldard to load
those into our two and our three,
and then we can move a 30
to bit number from R2 into
S2, which is, again, you
got to use the V Move Command
and then we can convert that
floating point number of S2
from a thirty two bit into
a 64 bit.
So floating 32 bit of floating
64 bit.
And then when we look at D one, we
can see that it has floating point
sixty four bit number is
one thousand or sorry,
one million.
So here's another example, so we
can go ahead and we have pie
and we have our big number so
we can load up pie, convert that
to a 64 bit number in a
row, and then we can load
up big. Right.
So, again, same thing that they did
before, convert that into a
64 bit number and then we can do
VML floating point sixty
four bit and we can multiply zero
times D one store the result in
D two.
So here we can see zero is
pi D one
is a million and then we
multiply them together and get our
result in D to.
And so this I just set a break point
and then trace through it using
GEF and GDB
so that I could look at the values
instead of having to necessarily
print them off. So the example is
very concise.
So today, we talked about some VPP
and the neon floating point
instructions and how they're kind of
intermixed together, especially
in the ARM documentation.
So looking forward, we'll give an
example using floating point and
we'll look at ACMD
and then in the future we'll talk
about the Modin conditional
execution.
So here's our quiz.
How would we convert a floating
point thirty two bit to
64 bit number?
So we can convert the
convert.
We're going to convert to a 64
bit number from a 30 to bed number
and we got our thirty two bit
register in our 64 bit register.
If you have questions, you can email
me, Miller, MJ at you and Kate, that
you, Edu and you can find me on
Twitter at now has 30.