This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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, AVR]: Fix PR33049 (implement extzv)


2011/6/21 Georg-Johann Lay <avr@gjlay.de>:
> Denis Chertykov schrieb:
>> 2011/6/20 Georg-Johann Lay <avr@gjlay.de>:
>>> This is an optimization patch that implements extzv for 1-bit extracts.
>>
>>
>>> +(define_insn_and_split "*extzv"
>>> + Â[(set (match_operand:QI 0 "register_operand" Â Â Â Â Â Â Â Â Â Â"=*d,*d,*d,r")
>>> + Â Â Â Â(zero_extract:QI (match_operand:QI 1 "register_operand" Â Â "0,r,0,r")
>>> + Â Â Â Â Â Â Â Â Â Â Â Â (const_int 1)
>>> + Â Â Â Â Â Â Â Â Â Â Â Â (match_operand:QI 2 "const_0_to_7_operand" "L,L,P,n")))]
>>> + Â""
>>> + Â"@
>>> + Â Âandi %0,1
>>> + Â Âmov %0,%1\;andi %0,1
>>> + Â Âlsr %0\;andi %0,1
>>> + Â Âbst %1,%2\;clr %0\;bld %0,0"
>>
>> Why you have a second constraint alternative (*d,r,L) ?
>> IMHO it's unnecessary.
>
> The second alternative takes 2 instructions/ticks whereas the last
> alternative -- which would be taken without alternative 2 -- takes 3
> instructions/ticks. ÂAs because of '*' there is no preference on
> register class, allocator just sees "r,r,n" and if the output register
> happens to end up in 'd' shorter sequences are possible in some cases.
> But there is no pressure being put to get such an alternative; in
> particular, allocator does not see "d,0,L" and does not emit a move to
> reload input.

Ok.

>
>>> + Â && REGNO (operands[0]) >= 16"
>>
>> It's not a good practice to refer to register as number.
>>
>> Denis.
>
> Ok. Âd_register_operand or satisfies_constraint_d would do. ÂBut I
> preferred to introduce a new constraint for 4 and avoid splitting
> *extzv altogether to keep it simple. ÂComplexity of splitting is not a
> real advantage over writing things down directly.
>
> As avr is running out of constraint letters, I started 3-letter
> constraints 'Y**' in the style of bfin. ÂWould be nice if 'K' was not
> already occupied or could be deprecated (is'n not really useful in
> inline asm)...

Better to choose starting letter different to pointer register names X,Y,Z.
May be better to use underscore '_' ?


Denis.


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