This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to tell PPC assembler VSX is available?


On Sat, Mar 10, 2018 at 10:44 PM, Peter Bergner <bergner@vnet.ibm.com> wrote:
> On 3/10/18 6:21 PM, Jeffrey Walton wrote:
>> $ g++ -DTEST_MAIN -g2 -O3 -mcpu=power8 sha256-p8.cxx -o sha256-p8.exe
>> /home/noloader/tmp/ccbDnfFr.s: Assembler messages:
>> /home/noloader/tmp/ccbDnfFr.s:758: Error: operand out of range (32 is
>> not between 0 and 31)
>> /home/noloader/tmp/ccbDnfFr.s:983: Error: operand out of range (48 is
>> not between 0 and 31)
>
> Works for me on gcc112.  Is your test case you show not actually what
> is failing?  Otherwise, can you compile with -S and attach the entire
> assembly file?

No, that's not the real code. The real code is a little more complex
and located at https://github.com/noloader/SHA-Intrinsics/blob/master/sha256-p8.cxx
.

The code provided here was using was the reproducer that did not do a
good job...

>> ...
>> typedef __vector unsigned int  uint32x4_p8;
>> ...
>>
>> uint32x4_p8 VEC_XL_BE(const uint8_t* data, int offset)
>> {
>> #if defined(__xlc__) || defined(__xlC__)
>>   return (uint32x4_p8)vec_xl_be(offset, (uint8_t*)data);
>> #else
>>   uint32x4_p8 res;
>>   __asm(" lxvd2x  %x0, %1, %2    \n\t"
>>         : "=wa" (res)
>>         : "g" (data), "g" (offset));
>>   return res;
>>
>> #endif
>> }
>
> Note that the "g" constraints you're using for (data) and (offset)
> really should be: "b" (data), "r" (offset)
> Using "b" with (data) is the important constraint, in that it tells the
> compiler not to use r0 for %1.  That's because "lxvd2x RD,RA,RB" uses
> the base value zero if RA equals r0 instead of the value contained in r0.

That fixed it. Thank you very much.

I used "g" from simple machine constraints. I thought giving GCC the
option of using memory or a register was the correct strategy. Sorry
about that.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]