This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH] S/390: HW accelerated iconv module for iso-8859-1/cp37 conversions


On 10/13/2015 02:07 PM, Florian Weimer wrote:
> On 10/13/2015 01:50 PM, Andreas Krebbel wrote:
>> On 10/13/2015 12:40 PM, Andreas Schwab wrote:
>>> "Andreas Krebbel" <krebbel@linux.vnet.ibm.com> writes:
>>>
>>>> +    asm volatile ("0:                        \n\t"			\
>>>> +                  "  troo    %0,%1           \n\t"			\
>>>> +                  "  jz      1f              \n\t"			\
>>>> +                  "  jo      0b              \n\t"			\
>>>> +                  "  llgc    %3,0(%1)        \n\t"			\
>>>> +                  "  la      %3,0(%3,%4)     \n\t"			\
>>>> +                  "  mvc     0(1,%0),0(%3)   \n\t"			\
>>>> +                  "  aghi    %1,1            \n\t"			\
>>>> +                  "  aghi    %0,1            \n\t"			\
>>>> +                  "  aghi    %2,-1           \n\t"			\
>>>> +                  "  j       0b              \n\t"			\
>>>> +                  "1:                        \n"			\
>>>> +									\
>>>> +     : "+a" (pOutput), "+a" (pInput), "+d" (length), "=&a" (tmp)        \
>>>
>>> That doesn't force %1 to be an even numbered register.
>>>
>>> ../iconv/loop.c: Assembler messages:
>>> ../iconv/loop.c:326: Fatal error: odd numbered general purpose register specified as register pair
>>
>> Only %0 is required to be a register pair. This is enforced with the register asm definition above:
>>
>> register unsigned char *pOutput asm ("2") = outptr;
>>
>> So it looks like GCC is not respecting the register asm in your case?!
> 
> GCC can make a copy of the register variable before passing it to the
> asm statement.  The “+” in the constraint probably encourages that.

No. GCC guarantees that it will use the register specified with register __asm__ as operand for
inline assemblies.  Please see: https://gcc.gnu.org/onlinedocs/gcc/Local-Reg-Vars.html#Local-Reg-Vars

"... However, using the variable as an input or output operand to the asm guarantees that the
specified register is used for that operand. See Extended Asm, for more information. ..."

Bye,

-Andreas-

> 
> You either have to use a more specific constraint which reflects the
> register requirements, or if none exists, drop pOutput from the list of
> outputs and rely exclusively on the register value for getting data in
> and out of the
> 
> Florian
> 


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