Re: [PATCH] Support folding min(poly,poly) to const

2023-09-07 Thread Lehua Ding
Hi Richard, On 2023/9/8 14:37, Richard Sandiford wrote: I think this should instead use poly_int_tree_p and wi::to_poly_widest. There's no need to handle int64 and uint64 separately. (And there's no need to handle just 64-bit types.) Thanks for the correction. I used wi::to_poly_wide(instead

Re: [PATCH] Support folding min(poly,poly) to const

2023-09-07 Thread Richard Sandiford via Gcc-patches
Lehua Ding writes: > Hi, > > This patch adds support that tries to fold `MIN (poly, poly)` to > a constant. Consider the following C Code: > > ``` > void foo2 (int* restrict a, int* restrict b, int n) > { > for (int i = 0; i < 3; i += 1) > a[i] += b[i]; > } > ``` > > Before this patch: >

Re: [PATCH] Support folding min(poly,poly) to const

2023-09-07 Thread Lehua Ding
Hi Andrew, On 2023/9/8 13:28, Andrew Pinski wrote: On Thu, Sep 7, 2023 at 10:25 PM Lehua Ding wrote: Hi, This patch adds support that tries to fold `MIN (poly, poly)` to a constant. Consider the following C Code: Does it make sense to handle max also? At the moment I can't construct a C

Re: [PATCH] Support folding min(poly,poly) to const

2023-09-07 Thread Andrew Pinski via Gcc-patches
On Thu, Sep 7, 2023 at 10:25 PM Lehua Ding wrote: > > Hi, > > This patch adds support that tries to fold `MIN (poly, poly)` to > a constant. Consider the following C Code: Does it make sense to handle max also? Thanks, Andrew > > ``` > void foo2 (int* restrict a, int* restrict b, int n) > { >