[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Transfer bit conserved by gcc?

From: Ruud Vlaming
Subject: Re: [avr-gcc-list] Transfer bit conserved by gcc?
Date: Sun, 21 Sep 2008 00:32:26 +0200
User-agent: KMail/1.9.1

On Saturday 20 September 2008 12:37, you wrote:
>> The md file states:
>> (define_insn "abssf2"
>>   [(set (match_operand:SF 0 "register_operand" "=d,r")
>>         (abs:SF (match_operand:SF 1 "register_operand" "0,0")))]
>>   ""
>>   "@
>>     andi %D0,0x7f
>>     clt\;bld %D0,7"
>>   [(set_attr "length" "1,2")
>>    (set_attr "cc" "set_n,clobber")])
>> I don't know how to read it, but loosely interpreted i 
>> understand the following:
>> abssf2 seems to be involved in the calculation of the
>> absolute value of a single precesion float. There are 
>> two ways to clean the msb of register %DO:
>> - one is and immideate with 0x7f and the 
>> - second is clear the T bit and load that zero on msb
>> Now since the first only works on registers r16 to r31 
>> sometimes the compiler chooses the second option?
> Yes that is exactly correct. "d" means r16..31 and "r" is r0..r31

Nice, would it then not be better to replace 
     clt\;bld %D0,7"
     rol %D0 \; lsr %D0"

This does the same thing, are not more instructions, and leave
the Transfer bit in tact (it conserves carry two, like andi)

Since this is the only place where the T bit is used, it seems
a sensible thing to do and it gives control of that bit back
to the assembly programmers.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]