OSP600 Lab 6 Vectorization Lab

In this lab we were asked to create a very simple program that will make sure the compiler will use  vectorization optimization when the program is compiled. This is the program :


This is a simple program where two arrays filled with random values are added together and stored in the third array. the program complied above with the -O3 flag will cause the code to be vectorizied. When obj dumping the compiled code above we get the following result. I will only show the <main> program as well as commented lines on what I think it happening the between the commands.



As for result on what is important within the vectorization. The following are the important instructions for vector additons :

LD1 {Vt.<T>, [base]

ADD Vd.<T>, Vn.<T>, Vm.<T>

ST1 {Vt.<T>}, [base]

Those instructions load the vector register with 1 element strctures from memory. To add them together we use the following instructions :

SXTL Vd.<Td>, Vn<Ts>

SXTL2 Vd.<Td>, Vn<Ts>

ADDP Dd, vn.2D

Those take signed integers in the first half of the vector, extend them , and store them in destination vector, does the same thing to the  second half and adds them together and stores them in destination register.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s