Hi Corey,

thanks for investigating.

Note that we use xlclang++ on AIX. It may possibly understand the directives as 
gcc on linux.
Gcc 7.3.1 is the minimum for BE linux.
But if you protect your code by #ifdef VM_LITTLE_ENDIAN no compiler except gcc 
>= 7.4.0 should ever look at it.

Best regards,
Martin


> -----Original Message-----
> From: Corey Ashford <cjash...@linux.ibm.com>
> Sent: Dienstag, 1. September 2020 02:17
> To: Doerr, Martin <martin.do...@sap.com>
> Cc: Michihiro Horie <ho...@jp.ibm.com>; hotspot-compiler-
> d...@openjdk.java.net; core-libs-dev <core-libs-dev@openjdk.java.net>;
> Kazunori Ogata <oga...@jp.ibm.com>; jos...@br.ibm.com
> Subject: Re: RFR(M): 8248188: [PATCH] Add HotSpotIntrinsicCandidate and
> API for Base64 decoding
> 
> On 8/27/20 8:07 AM, Doerr, Martin wrote:
> >>> I will use __attribute__ ((align(16))) instead of __vector, and make
> >> them arrays of 16 unsigned char.
> > Maybe __vectors works as expected, too, now. Whatever we use, I'd
> appreciate to double-check the alignment e.g. by using gdb.
> > I don't remember what we had tried and why it didn't work as desired.
> 
> 
> I just now tried on gcc-7.5.0, declaring a __vector at 1, 2, 3, 8, 9,
> and 15 byte offsets in a struct, trying to force a misalignment, but the
> compiler realigned all of them on 16-byte boundaries.
> 
> If someone decides to make the intrinsic work on AIX (big endian), and
> compiles with 7.3.1, I don't know what will happen w.r.t. alignment, so
> to be on the safe side, I will make the declarations 16-byte unsigned
> char arrays with an align attribute.
> 
> Looking a bit deeper, I see that the __vector type comes out of the C
> preprocessor as: __attribute__((altivec(vector__))). It's part of the
> compiler's basic set of predefined macros, and can be seen using this
> command:
> 
> %  gcc -dM -E - < /dev/null | grep __vector
> 
> #define __vector __attribute__((altivec(vector__)))
> 
> Some information here:
> https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Type-Attributes.html
> 
> I don't know if this is helpful or not, but it might answer part of your
> question about the meaning of __vector.
> 
> Regards,
> 
> - Corey

Reply via email to