How to declare a vector of data

0

I'm doing an Assembly program in ArmV8 that uses multiple constants (in floating point) that are therefore multiplied by the a certain value (also in floating point). For that, I want to develop a loop that just went trought a vector that contained the constants, incrementing the address each time to access the next constant, multiply it and so on, instead of repeating the same operation again and again. Although, I'm not sure how to declare this vector directly in the Assembly program.

In ArmV7 I did something like this to achieve that purpose:

Aux         DCD     0x7F800000, 0x007FFFFF, 0x7FFFFFFF

But this only works for words in ArmV7 and I was working with doubles in ArmV8.

assembly
arm
arm64
armv8
asked on Stack Overflow Jun 6, 2019 by Educorreia

1 Answer

1

You're not declaring a vector, all you need here is a literal constant in the source. Assuming Arm Compiler 6, 7.21 DCQ and DCQU

The DCQ directive allocates one or more eight-byte blocks of memory, aligned on four-byte boundaries, and defines the initial runtime contents of the memory. DCQU is the same, except that the memory alignment is arbitrary.

Since memory isn't typed, there is no reason other than readability not to use DCD still. If your literal is a float, you can also use DCFD or DCFS.

answered on Stack Overflow Jun 7, 2019 by Sean Houlihane

User contributions licensed under CC BY-SA 3.0