This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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 5/5] Remove const attribute on get_log2


On 05/15/2013 07:56 AM, Richard Henderson wrote:
> On 05/15/2013 12:50 AM, Andreas Schwab wrote:
>> Florian Weimer <fweimer@redhat.com> writes:
>>
>>> I think that at one point, it was fully acceptable to label functions
>>> which perform memoization as "const".
>>
>> I think that's what pure is for.
> 
> No, "pure" is for functions that only read from memory, but don't write.
> So if we're talking about the letter of the law, memoization isn't allowed
> there either.
> 
> I don't like that LLVM's optimization breaks with such long standing usage of
> the attribute, and I will claim that it's a bug.
> 
> That said, get_log2 is used in exactly one place in math/atest-exp2.c, and it's
> a place that's not going to be helped by the const attribute at all.  I'm ok
> with removing the attribute in this case.
> 
> Much more useful would be figuring out a way to store the log2/exp1/exp_m1
> values as mp_limb_t's rather than strings.  Then we have no runtime
> initialization at all.

I've pushed patch 5/5 to master as well.


r~


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