Re: [PATCH v2 7/8] transform (A << S) >> S into A & (-1 >> S)

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

 



On Tue, Aug 8, 2017 at 12:08 AM, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> On Mon, Aug 7, 2017 at 11:54 PM, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>> On Mon, Aug 7, 2017 at 12:12 PM, Luc Van Oostenryck
>> <luc.vanoostenryck@xxxxxxxxx> wrote:
>>> +               // replace (A << S) >> S
>>> +               // by      A & (-1 >> S)
>>
>> Umm. This seems misleading.
>>
>> Don't you mean "value of all ones of the same size as A, shifted right by S"
>>
>>> +               insn->src2 = value_pseudo(-1ULL >> value);
>>
>> ..and this seems buggy. There's a lot of bits in -1ULL, but what if
>> the size of 'S' is only 32-bit?
>>
>> So I think you should take the size of A into account?
>>
>> Or am I missing something?

You're right. It must be wrong.
I think it's working but only because in the tests I've used
it's optimized away.

-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux