On Thu, May 11, 2017 at 12:22 PM, Steven Munroe
<munro...@linux.vnet.ibm.com> wrote:
> On Thu, 2017-05-11 at 09:39 -0500, Segher Boessenkool wrote:
>> On Wed, May 10, 2017 at 12:59:28PM -0500, Steven Munroe wrote:
>> > > That is just for the testsuite; I meant what happens if a user tries
>> > > to use it with an older target (or BE, or 32-bit)?  Is there a useful,
>> > > obvious error message?
>> > >
>> > So looking at the X86 headers, their current practice falls into two two
>> > areas.
>> >
>> > 1) guard 64-bit dependent intrinsic functions with:
>> >
>> > #ifdef __x86_64__
>> > #endif
>> >
>> > But they do not provide any warnings. I assume that attempting to use an
>> > intrinsic of this class would result in an implicit function declaration
>> > and a link-time failure.
>>
>> Yeah probably.  Which is fine -- it does not silently do the wrong thing,
>> and it is easy to find where the problem is.
>>
>> > If GCC does support that target then the '#pragma GCC target("avx")'
>> > will enable code generation, but the user might get a SIGILL if the
>> > hardware they have does not support those instructions.
>>
>> That is less friendly, but it still does not silently generate bad code.
>>
>> > In the BMI headers I already guard with:
>> >
>> > #ifdef  __PPC64__
>> > #endif
>> >
>> > This means that like x86_64, attempting to use _pext_u64 on a 32-bit
>> > compiler will result in an implicit function declaration and cause a
>> > linker error.
>>
>> Yup, that's fine.
>>
>> > This is sufficient for most of BMI and BMI2 (registers only / endian
>> > agnostic). But this does not address the larger issues (for SSE/SSE2+)
>> > which needing VXS implementation or restricting to LE.
>>
>> Right.
>>
>> > So should I check for:
>> >
>> > #ifdef __VSX__
>> > #endif
>> >
>> > or
>> >
>> > #ifdef __POWER8_VECTOR__
>> >
>> > or
>> >
>> > #ifdef _ARCH_PWR8
>> >
>> > and perhaps:
>> >
>> > #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
>> >
>> > as well to enforce this.
>> >
>> > And are you suggesting I add an #else clause with #warning or #error? Or
>> > is the implicit function and link failure sufficient?
>>
>> The first is friendlier, the second is sufficient I think.
>>
>> Maybe it is good enough to check for LE only?  Most unmodified code
>> written for x86 (using intrinsics etc.) will not work correctly on BE.
>> And if you restrict to LE you get 64-bit and POWER8 automatically.
>>
>> So maybe just require LE?
>>
> Ok I will add "#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__" guard for
> the MMX/SSE and later intrinsic headers.

Steve,

All of these the testcases for the new functionality are failing on AIX.

The testcases should use a target of lp64, not explicitly use -m64 option.

I don't know if it's useful to run the tests on AIX, but they
definitely should use lp64 and not the explicit option.

Thanks, David

Reply via email to