Conditional negation elimination in tree-ssa-phiopt.c

Marc Glisse marc.glisse@inria.fr
Tue Aug 12 11:01:00 GMT 2014


On Mon, 11 Aug 2014, Kyrill Tkachov wrote:

> The aarch64 target has a conditional negation instruction
> CSNEG Rd, Rs1, Rs2, cond
>
> with semantics Rd = if cond then Rs1 else -Rs2.
>
> This, however doesn't get end up getting matched for code such as:
> int
> foo2 (unsigned a, unsigned b)
> {
>  int r = 0;
>  r = a & b;
>  if (a & b)
>    return -r;
>  return r;
> }

Note that in this particular case, we should just return -(a&b) like llvm 
does.

-- 
Marc Glisse



More information about the Gcc mailing list