On 08/12/2015 07:02 AM, Segher Boessenkool wrote:
> On Tue, Aug 11, 2015 at 06:11:35PM -0700, Richard Henderson wrote:
>> @@ -8173,6 +8173,13 @@ genimm_ppc::exam_search (HOST_WIDE_INT c, int budget)
>> if (exam_mask (-1, c, sub_budget))
>> return true;
>>
>> + /* If the two halves are equal, use an insert. */
>> + if (c >> 32 == test && exam_sub (test, sub_budget))
>> + {
>> + opN (VEC_DUPLICATE, 0xffffffffu); /* RLDIMI */
>> + return true;
>> + }
>
> Does this work for c with the high bit set? I think you need
> to cast it to unsigned HOST_WIDE_INT first?
Indeed, a sign-extension works better. It means the base constant will use
LIS+ORIS without trying to create an unsigned version.
If you're talking about ubsan sort of restrictions on shifting signed
constants... I choose to totally ignore that. Certainly no where else in gcc
has been audited for that, beginning with hwint.h itself.
r~