Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-07 Thread Jeff Law
On 07/03/2017 12:59 PM, Marc Glisse wrote: >> What happens if @0 is a floating point type? Based on the variable name >> "itype" and passing TYPE_PRECISION (itype) to real_to_integer, it seems >> like you're expecting @0 to be an integer. If so, you should verify >> that it really is an integer

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-03 Thread Marc Glisse
On Mon, 3 Jul 2017, Jeff Law wrote: On 07/02/2017 11:03 AM, Yuri Gribov wrote: Hi all, This is initial patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Per Joseph's suggestion it optimizes (float)lhs CMP rhs (double)lhs CMP rhs to lhs CMP (typeof(x))rhs whenever typeof(x)

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-03 Thread Yuri Gribov
On Mon, Jul 3, 2017 at 4:28 PM, Jeff Law wrote: > On 07/03/2017 08:52 AM, Joseph Myers wrote: >> I'd expect much more thorough testcases here, both for cases that get >> optimized and cases that don't. You're only testing comparisons with >> zero. There should be comparisons

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-03 Thread Yuri Gribov
On Mon, Jul 3, 2017 at 4:38 PM, Jeff Law wrote: > On 07/02/2017 11:03 AM, Yuri Gribov wrote: >> Hi all, >> >> This is initial patch for >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Per Joseph's >> suggestion it optimizes >> (float)lhs CMP rhs >> (double)lhs CMP rhs

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-03 Thread Jeff Law
On 07/02/2017 11:03 AM, Yuri Gribov wrote: > Hi all, > > This is initial patch for > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Per Joseph's > suggestion it optimizes > (float)lhs CMP rhs > (double)lhs CMP rhs > to > lhs CMP (typeof(x))rhs > whenever typeof(x) can be precisely

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-03 Thread Jeff Law
On 07/03/2017 08:52 AM, Joseph Myers wrote: > I'd expect much more thorough testcases here, both for cases that get > optimized and cases that don't. You're only testing comparisons with > zero. There should be comparisons with other values, both integer and > noninteger, both within the

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-03 Thread Joseph Myers
I'd expect much more thorough testcases here, both for cases that get optimized and cases that don't. You're only testing comparisons with zero. There should be comparisons with other values, both integer and noninteger, both within the range for which optimizing would be valid and outside

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-02 Thread Yuri Gribov
On Sun, Jul 2, 2017 at 6:03 PM, Yuri Gribov wrote: > Hi all, > > This is initial patch for > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Per Joseph's > suggestion it optimizes > (float)lhs CMP rhs > (double)lhs CMP rhs > to > lhs CMP (typeof(x))rhs > whenever

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-02 Thread Marc Glisse
On Sun, 2 Jul 2017, Yuri Gribov wrote: On Sun, Jul 2, 2017 at 6:32 PM, Marc Glisse wrote: On Sun, 2 Jul 2017, Yuri Gribov wrote: This is initial patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Thanks. I have had this unfinished, probably wrong patch on

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-02 Thread Yuri Gribov
On Sun, Jul 2, 2017 at 6:32 PM, Marc Glisse wrote: > On Sun, 2 Jul 2017, Yuri Gribov wrote: > >> This is initial patch for >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . > > Thanks. I have had this unfinished, probably wrong patch on my hard drive > for 4 years, I

Re: [PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-02 Thread Marc Glisse
On Sun, 2 Jul 2017, Yuri Gribov wrote: This is initial patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Thanks. I have had this unfinished, probably wrong patch on my hard drive for 4 years, I doubt there is much you can extract from it, but just in case... -- Marc

[PATCH][PR 57371] Remove useless floating point casts in comparisons

2017-07-02 Thread Yuri Gribov
Hi all, This is initial patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57371 . Per Joseph's suggestion it optimizes (float)lhs CMP rhs (double)lhs CMP rhs to lhs CMP (typeof(x))rhs whenever typeof(x) can be precisely represented by floating-point type (e.g. short by float or int by