[cfe-dev] Why short3 uses 8 bytes like short4?

Yin Ma yinma at codeaurora.org
Fri Jan 6 14:23:30 PST 2012


With the new change, LLVM/Clang defines 

typedef short short3 __attribute__((ext_vector_type(3)));

 

to be size of 8. 

sizeof( short3 ) = 8 

 

and for short3 array, one element takes 8 bytes. 

 

&m[0] = 0xbed63b20 

&m[1] = 0xbed63b28 

&m[2] = 0xbed63b30 

&m[3] = 0xbed63b38 

 

I notice the older LLVM/Clang still allocate short3 to be 6 byte element. 

Is there any historical reason to make 6 byte short3 to become 8 byte
short4?

Is short3 supposed to be defined as three shorts in a row. It is a little
difficult 

to connect with other language like Java JNI. 

 

Thanks,

 

                                  Yin 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120106/8d223c80/attachment.html>


More information about the cfe-dev mailing list