[PATCH] fold a * (a > 0 ? 1 : -1) to abs(a) and related optimizations

2017-06-23 Thread Andrew Pinski
Hi, I saw this on llvm's review site (https://reviews.llvm.org/D34579) and I thought why not add it to GCC. I expanded more than what was done on the LLVM patch. I added the following optimizations: Transform X * (X > 0 ? 1 : -1) into ABS(X). Transform X * (X >= 0 ? 1 : -1) into ABS(X). Transfo

Re: [PATCH] fold a * (a > 0 ? 1 : -1) to abs(a) and related optimizations

2017-06-23 Thread Andrew Pinski
Forgot the patch On Fri, Jun 23, 2017 at 8:59 PM, Andrew Pinski wrote: > Hi, > I saw this on llvm's review site (https://reviews.llvm.org/D34579) > and I thought why not add it to GCC. I expanded more than what was > done on the LLVM patch. > > I added the following optimizations: > Transform

Re: [PATCH] fold a * (a > 0 ? 1 : -1) to abs(a) and related optimizations

2017-06-23 Thread Marc Glisse
On Fri, 23 Jun 2017, Andrew Pinski wrote: Hi, I saw this on llvm's review site (https://reviews.llvm.org/D34579) and I thought why not add it to GCC. I expanded more than what was done on the LLVM patch. I added the following optimizations: Transform X * (X > 0 ? 1 : -1) into ABS(X). Transfor

<    1   2