+/* Optimize (X & (-A)) / A where A is a power of 2, to X >> log2(A) */
+(for div (trunc_div ceil_div floor_div round_div exact_div)
+ (simplify
+ (div (convert? (bit_and @0 INTEGER_CST@1)) INTEGER_CST@2)
+ (if (!TYPE_UNSIGNED (type) && integer_pow2p (@2)
+ && tree_int_cst_sgn (@2) > 0
+
Hi,
>> it probably works for all integer divisions (floor_div, etc)
>> since it is exact and thus does not depend on the rounding.
Please find attached the modified patch as per comments.
Thanks,
Naveendiff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ee9b349..88dbbdd 100644
--- a/gcc/fold-
On November 5, 2015 2:40:30 PM GMT+01:00, Michael Matz wrote:
>Hi,
>
>On Wed, 4 Nov 2015, Richard Biener wrote:
>
>> Ah, it was _left_ shift of negative values that ubsan complains
>about.
>
>Note that this is only for the frontend definition of shifts. I don't
>see
>why gimple shouldn't define
Hi,
On Wed, 4 Nov 2015, Richard Biener wrote:
> Ah, it was _left_ shift of negative values that ubsan complains about.
Note that this is only for the frontend definition of shifts. I don't see
why gimple shouldn't define it to the only sensible definition there is,
which also happens to be th
+/* Optimize (X & (-A)) / A where A is a power of 2, to X >> log2(A) */
+(for div (exact_div trunc_div)
Actually, it probably works for all integer divisions (floor_div, etc)
since it is exact and thus does not depend on the rounding.
(sorry for giving the comments small piece by small piece,
Hi,
Please find attached the modified patch as per review comments.
>> use :s on both inner rdiv in both patterns. With that the two patterns are
>> ok.
Done.
>> Omit the parens around REAL_CST@0
Done.
Regression tested on X86_64.
Thanks,
Naveendiff --git a/gcc/fold-const.c b/gcc/fold-const.
On Wed, Nov 4, 2015 at 1:45 PM, Marc Glisse wrote:
> On Wed, 4 Nov 2015, Richard Biener wrote:
>
>>> I don't really remember what the tests !TYPE_UNSIGNED (type) and
>>> tree_int_cst_sgn are for in the other pattern, but since you are only
>>> moving
>>> the transformation...
>>
>>
>> +/* Optimize
On Wed, 4 Nov 2015, Richard Biener wrote:
I don't really remember what the tests !TYPE_UNSIGNED (type) and
tree_int_cst_sgn are for in the other pattern, but since you are only moving
the transformation...
+/* Optimize (X & (-A)) / A where A is a power of 2, to X >> log2(A) */
+(for div (exact
On Wed, Nov 4, 2015 at 12:18 PM, Marc Glisse wrote:
> On Wed, 4 Nov 2015, Hurugalawadi, Naveen wrote:
>
I thought we were mostly using the 'convert?'
and tree_nop_conversion_p on integers
Yes, on floats they shouldn't be used.
>>
>> Done. Cleared all instances of convert which are not
On Wed, 4 Nov 2015, Hurugalawadi, Naveen wrote:
I thought we were mostly using the 'convert?'
and tree_nop_conversion_p on integers
Done. Cleared all instances of convert which are not required.
However, I am still confused about the use of "convert" in match
and simplify.
It could be that I
Hi,
Thanks for the review and comments.
>> I thought we were mostly using the 'convert?'
>> and tree_nop_conversion_p on integers
Done. Cleared all instances of convert which are not required.
However, I am still confused about the use of "convert" in match
and simplify.
>> So all patterns loo
(I didn't read everything)
+/* Convert (A/B)/C to A/(B*C) */
+(simplify
+ (rdiv (convert? (rdiv @0 @1)) (convert? @2))
+ (if (flag_reciprocal_math
+ && tree_nop_conversion_p (type, TREE_TYPE (@0))
+ && tree_nop_conversion_p (type, TREE_TYPE (@2)))
+ (rdiv (convert @0) (convert (mu
12 matches
Mail list logo