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 Mar 12, 2018, at 9:00 AM, Segher Boessenkool <segher@kernel.crashing.org> wrote:
> 
> On Mon, Mar 12, 2018 at 09:37:04AM -0400, Jeffrey Walton wrote:
>>> Peter's advice is good; however you should use the *memory* as input
>>> to your asm, not the address of the memory!  Or if you really do not
>>> want to, at least you have to describe that that memory is read.  If
>>> you do not care much about optimisation you can use a "memory" clobber
>>> for that.
> 
>> In this context:
>> 
>>>>  uint32x4_p8 res;
>>>>  __asm(" lxvd2x  %x0, %1, %2    \n\t"
>>>>        : "=wa" (res)
>>>>        : "g" (data), "g" (offset));
>> 
>> So are you saying to use something along the lines of  `"m" (*(const
>> char (*)[10]) p)`. Maybe:
>> 
>>    uint32x4_p8 res;
>>    __asm(" lxvd2x  %x0, %1, %2    \n\t"
>>          : "=wa" (res)
>>          : "m" (*(const unsigned int (*)[4]) data), "r" (offset));
> 
> Something like
> 
> 	asm("lxvd2x %x0,%1" : "=wa"(res) : "Z"(data[offset/4]));
> 
> ("Z", because the lxvd2x instruction only allows reg+reg addressing).
> 
> It is even better to not write load/store instruction in asm at all, let
> the compiler figure it out.  Work _with_ the compiler, not against it.
> And use builtins instead of asm where you can.

Hi Segher,

In this case the compiler is letting him down -- we didn't have 
support for the vec_xl_be built-in in earlier versions of GCC, so to
generate an lxvd2x without a swap for a variety of compilers to
consume, this looks like the right path for him.

Thanks,
Bill
> 
> 
> Segher
> 


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