[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140514074300.GA17409@samfundet.no>
Date: Wed, 14 May 2014 09:43:00 +0200
From: Hans-Christian Egtvedt <egtvedt@...fundet.no>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
mingo@...nel.org, will.deacon@....com, paulmck@...ux.vnet.ibm.com,
Haavard Skinnemoen <hskinnemoen@...il.com>
Subject: Re: [PATCH 06/20] arch,avr32: Fold atomic_ops
Around Tue 13 May 2014 22:50:45 +0200 or thereabout, Peter Zijlstra wrote:
> On Tue, May 13, 2014 at 10:40:32PM +0200, Hans-Christian Egtvedt wrote:
>> Probably found the reason why we want to use sub with the signed 21-bit
>> limit, it uses one less register than the add instruction that can add up to
>> 32-bit values.
>>
>> Both instructions are 32-bit, to use a 16-bit instruction the immediate is
>> very small; 4 bit.
>>
>> sub 32-bit, type IV, takes a register and subtracts a 21-bit immediate.
>> add 32-bit, type II, adds two register values together.
>>
>> So by simplifying you loose this optimization.
>
> OK, let me try if I can come up with anything sane for this.
>
> Re, adding atomic_{or,and,xor}() those should all use the same bits as
> add, right, except for the special case using sub.
OR and XOR (EOR in the manual) instruction will fall into type II or III,
both 32-bit, and (x)ors two registers together, difference is which way they
can do a shift on one of the registers.
So yes, identical as add.
--
Hans-Christian Egtvedt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists