lkml.org 
[lkml]   [2015]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:core/types] bitops: Add sign_extend8(), 16 and 64 functions
On 02/04/2015 11:17 PM, Ingo Molnar wrote:
>
> * H. Peter Anvin <hpa@zytor.com> wrote:
>
>> On 01/19/2015 02:04 AM, Peter Zijlstra wrote:
>>> On Mon, Jan 19, 2015 at 07:54:22AM +1200, Linus Torvalds wrote:
>>>> Why?
>>>>
>>>> The 8- and 16- bit versions are the same as the 32-bit one.
>>>> This seems pointless. If you want something where the sign
>>>> is in bit 3, they all return the same value, just the return
>>>> type differs, but that's really a *caller* thing, no?
>>>
>>> Even for the 8bit ones? Since we have the *H and *L register
>>> we have more 8 bit regs than we have 16/32 bit regs and it
>>> might just be worth it.
>>
>> Fewer, actually. gcc doesn't really use the H registers much,
>
> Is that true for other compilers as well?
>
>> and instead considers 8-bit values to occupy the whole
>> register, but that means only four are available in 32-bit
>> mode.
>
> So where are we with this? Should I consider:
>
> 7e9358073d3f ("bitops: Add sign_extend8(), 16 and 64 functions")
>
> NAK-ed due to having marginal benefits, or due to having no
> benefits whatsoever?
>
> How about the two patch series from Martin Keppling - that does
> seem to be both beneficial and correct, agreed?
>
Do you mean the two patches improving the documentation of
sign_extend32 and adding sign_extend64 ? I thought those
would be valuable.

The discussion resulted in sign_extend32() being used for non-32-bit
operations, so that by itself was quite useful.

Guenter



\
 
 \ /
  Last update: 2015-02-05 15:21    [W:0.058 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site