Skip to content

Conversation

jingedawang
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant