AlignmentExample icon indicating copy to clipboard operation
AlignmentExample copied to clipboard

Display the effect of aligned_double4 in dynamic allocating.

Open jingedawang opened this issue 3 years ago • 0 comments

Please check the change in aligned_heap_vectorization.cpp.

We added x before data and y z after data. Then print the address for all these fields.

The output in my computer is:

address of input1.x: 0x55fb7ffa9ec0
address of input1: 0x55fb7ffa9ee0
address of input1.y: 0x55fb7ffa9f00
address of input1.z: 0x55fb7ffa9f04
(2, 3, 4, 5)

You can see x data and y are all 32-byte aligned, but z is not. x is 32-byte aligned because it's the first field in the object and the object is 32-byte aligned. data is 32-byte aligned because the aligned_double4 still take effect, which forms the relative location for the data in the object. y is 32-byte aligned because the data happens to occupy 32 bytes. So y just locate behind it. z is not 32-byte aligned because y only occupies 4 bytes. z itself doesn't declare any alignment attributes, so it is put right behind y.

jingedawang avatar May 09 '22 08:05 jingedawang